diff options
author | Alex Yatskov <alex@foosoft.net> | 2016-03-24 20:30:18 -0700 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2016-03-24 20:30:18 -0700 |
commit | ac012b26b37f6c01a80c1faa98fbe43913e47b6e (patch) | |
tree | 7a6c631fea599ad2c4e2faa7a769e010f142027f /ext/jp | |
parent | 1b278320542fd18a6426b433ea4d042781311812 (diff) |
File reorg and cleanup
Diffstat (limited to 'ext/jp')
-rw-r--r-- | ext/jp/api.js (renamed from ext/jp/init.js) | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/ext/jp/init.js b/ext/jp/api.js index 56ec8b34..3f15056a 100644 --- a/ext/jp/init.js +++ b/ext/jp/api.js @@ -17,20 +17,6 @@ */ -function onInit() { - const test = trans.findTerm('食べられない'); - chrome.runtime.onMessage.addListener(onMessage); -} - -const res = { - rules: 'jp/data/rules.json', - edict: 'jp/data/edict.json', - enamdict: 'jp/data/enamdict.json', - kanjidic: 'jp/data/kanjidic.json' -}; - -window.trans = new Translator(res, onInit); - function onMessage(request, sender, callback) { switch (request.action.toLowerCase()) { case 'define': @@ -39,3 +25,15 @@ function onMessage(request, sender, callback) { } } +(() => { + const res = { + rules: 'jp/data/rules.json', + edict: 'jp/data/edict.json', + enamdict: 'jp/data/enamdict.json', + kanjidic: 'jp/data/kanjidic.json' + }; + + window.trans = new Translator(res, function() { + chrome.runtime.onMessage.addListener(onMessage); + }); +})(); |