diff options
author | Alex Yatskov <alex@foosoft.net> | 2016-09-14 21:08:51 -0700 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2016-09-14 21:08:51 -0700 |
commit | ce49a126cf156d6886e664f80417a2b65ff118ba (patch) | |
tree | 00becd8ec36bacf7441e56794f1d5eef09faadf2 /ext/bg/js/yomichan.js | |
parent | b9d53f8427dde34900799295287c634a68d00687 (diff) |
Progress bar
Diffstat (limited to 'ext/bg/js/yomichan.js')
-rw-r--r-- | ext/bg/js/yomichan.js | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/ext/bg/js/yomichan.js b/ext/bg/js/yomichan.js index c9f53253..bec34691 100644 --- a/ext/bg/js/yomichan.js +++ b/ext/bg/js/yomichan.js @@ -23,6 +23,7 @@ class Yomichan { Handlebars.registerHelper('kanjiLinks', kanjiLinks); this.translator = new Translator(); + this.importTabId = null; this.asyncPools = {}; this.ankiConnectVer = 0; this.setState('disabled'); @@ -48,7 +49,17 @@ class Yomichan { } onImport({state, progress}) { - console.log(`${state}: ${progress}`); + if (state === 'begin') { + chrome.tabs.create({url: chrome.extension.getURL('bg/import.html')}, tab => this.importTabId = tab.id); + } + + if (this.importTabId !== null) { + chrome.tabs.sendMessage(this.importTabId, {state, progress}, () => null); + } + + if (state === 'end') { + this.importTabId = null; + } } onMessage(request, sender, callback) { |