summaryrefslogtreecommitdiff
path: root/ext/bg/js/yomichan.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bg/js/yomichan.js')
-rw-r--r--ext/bg/js/yomichan.js13
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) {