diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-03-30 20:39:04 -0400 |
---|---|---|
committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-03-30 20:39:04 -0400 |
commit | c193a703cc1444fbc75e62954ca3a10210ad95d0 (patch) | |
tree | c34f80b71f058cc256795ea52df7972bb8766290 /ext/bg/js/translator.js | |
parent | 8095d9138c413f27b26c9ccba2ca2ae9762707f3 (diff) |
Move database creation into Backend
Diffstat (limited to 'ext/bg/js/translator.js')
-rw-r--r-- | ext/bg/js/translator.js | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/ext/bg/js/translator.js b/ext/bg/js/translator.js index 6f43f7b0..df19eee1 100644 --- a/ext/bg/js/translator.js +++ b/ext/bg/js/translator.js @@ -17,7 +17,6 @@ */ /* global - * Database * Deinflector * dictEnabledSet * dictTagBuildSource @@ -34,23 +33,16 @@ */ class Translator { - constructor() { - this.database = null; + constructor(database) { + this.database = database; this.deinflector = null; this.tagCache = new Map(); } async prepare() { - if (!this.database) { - this.database = new Database(); - await this.database.prepare(); - } - - if (!this.deinflector) { - const url = chrome.runtime.getURL('/bg/lang/deinflect.json'); - const reasons = await requestJson(url, 'GET'); - this.deinflector = new Deinflector(reasons); - } + const url = chrome.runtime.getURL('/bg/lang/deinflect.json'); + const reasons = await requestJson(url, 'GET'); + this.deinflector = new Deinflector(reasons); } async purgeDatabase() { |