Tests
This commit is contained in:
parent
62a47278b5
commit
14f855ee75
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
|
|
||||||
function onInit() {
|
function onInit() {
|
||||||
|
const test = trans.findTerm('食べられない');
|
||||||
chrome.runtime.onMessage.addListener(onMessage);
|
chrome.runtime.onMessage.addListener(onMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,12 +29,12 @@ const res = {
|
|||||||
kanjidic: 'jp/data/kanjidic.json'
|
kanjidic: 'jp/data/kanjidic.json'
|
||||||
};
|
};
|
||||||
|
|
||||||
const trans = new Translator(res, onInit);
|
window.trans = new Translator(res, onInit);
|
||||||
|
|
||||||
function onMessage(request, sender, callback) {
|
function onMessage(request, sender, callback) {
|
||||||
switch (request.action.toLowerCase()) {
|
switch (request.action.toLowerCase()) {
|
||||||
case 'define':
|
case 'define':
|
||||||
callback(trans.findTerm(request.text));
|
callback(window.trans.findTerm(request.text));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user