summaryrefslogtreecommitdiff
path: root/ext/bg/js/translator.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-07-10 14:30:34 -0700
committerAlex Yatskov <alex@foosoft.net>2017-07-10 14:30:34 -0700
commit49352c5fa1baea4a6ed7d71d1353c13a56b00bca (patch)
tree0b54d72dd2b1939f31a1bc0a1b34c8866b797f4b /ext/bg/js/translator.js
parentb6f3919ef63f969769fbf030e8fd8b14b0e1c214 (diff)
move deinflector to async
Diffstat (limited to 'ext/bg/js/translator.js')
-rw-r--r--ext/bg/js/translator.js16
1 files changed, 9 insertions, 7 deletions
diff --git a/ext/bg/js/translator.js b/ext/bg/js/translator.js
index 35b49608..84a6e1d7 100644
--- a/ext/bg/js/translator.js
+++ b/ext/bg/js/translator.js
@@ -19,17 +19,19 @@
class Translator {
constructor() {
- this.database = new Database();
- this.deinflector = new Deinflector();
- this.loaded = false;
+ this.database = null;
+ this.deinflector = null;
}
async prepare() {
- if (!this.loaded) {
- const reasons = await jsonLoadInt('/bg/lang/deinflect.json');
- this.deinflector.setReasons(reasons);
+ if (!this.database) {
+ this.database = new Database();
await this.database.prepare();
- this.loaded = true;
+ }
+
+ if (!this.deinflector) {
+ const reasons = await jsonLoadInt('/bg/lang/deinflect.json');
+ this.deinflector = new Deinflector(reasons);
}
}