aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/translator.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-04-05 12:52:07 -0400
committerGitHub <noreply@github.com>2020-04-05 12:52:07 -0400
commit3684a479c5e12efe63c54e5532a264d157a6816d (patch)
treebb1a3141c37836ab0f8a1cbff5ed781cc41eac39 /ext/bg/js/translator.js
parent058f626efd6c5d6fae66346d487c10930d769971 (diff)
parent9052ab8ebd5af505f1992bfc001b226202e2f393 (diff)
Merge pull request #424 from toasted-nutbread/dictionary-importer
Dictionary importer
Diffstat (limited to 'ext/bg/js/translator.js')
-rw-r--r--ext/bg/js/translator.js18
1 files changed, 5 insertions, 13 deletions
diff --git a/ext/bg/js/translator.js b/ext/bg/js/translator.js
index cd991efa..27f91c05 100644
--- a/ext/bg/js/translator.js
+++ b/ext/bg/js/translator.js
@@ -17,7 +17,6 @@
*/
/* global
- * Database
* Deinflector
* TextSourceMap
* dictEnabledSet
@@ -35,23 +34,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() {