diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-04-05 12:52:07 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-05 12:52:07 -0400 |
commit | 3684a479c5e12efe63c54e5532a264d157a6816d (patch) | |
tree | bb1a3141c37836ab0f8a1cbff5ed781cc41eac39 /ext/bg/js/backend.js | |
parent | 058f626efd6c5d6fae66346d487c10930d769971 (diff) | |
parent | 9052ab8ebd5af505f1992bfc001b226202e2f393 (diff) |
Merge pull request #424 from toasted-nutbread/dictionary-importer
Dictionary importer
Diffstat (limited to 'ext/bg/js/backend.js')
-rw-r--r-- | ext/bg/js/backend.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index b217e64d..1e8c979f 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -24,6 +24,8 @@ * AudioUriBuilder * BackendApiForwarder * ClipboardMonitor + * Database + * DictionaryImporter * JsonSchema * Mecab * Translator @@ -43,7 +45,9 @@ class Backend { constructor() { - this.translator = new Translator(); + this.database = new Database(); + this.dictionaryImporter = new DictionaryImporter(); + this.translator = new Translator(this.database); this.anki = new AnkiNull(); this.mecab = new Mecab(); this.clipboardMonitor = new ClipboardMonitor({getClipboard: this._onApiClipboardGet.bind(this)}); @@ -107,6 +111,7 @@ class Backend { } async prepare() { + await this.database.prepare(); await this.translator.prepare(); this.optionsSchema = await requestJson(chrome.runtime.getURL('/bg/data/options-schema.json'), 'GET'); @@ -296,6 +301,10 @@ class Backend { return true; } + async importDictionary(archiveSource, onProgress, details) { + return await this.dictionaryImporter.import(this.database, archiveSource, onProgress, details); + } + // Message handlers _onApiYomichanCoreReady(_params, sender) { |