aboutsummaryrefslogtreecommitdiff
path: root/ext/mixed
diff options
context:
space:
mode:
Diffstat (limited to 'ext/mixed')
-rw-r--r--ext/mixed/js/display.js24
1 files changed, 12 insertions, 12 deletions
diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js
index cee63d9b..8dea625d 100644
--- a/ext/mixed/js/display.js
+++ b/ext/mixed/js/display.js
@@ -43,6 +43,16 @@ class Display {
this.setInteractive(true);
}
+ async prepare(options=null) {
+ await this.displayGenerator.prepare();
+ await this.updateOptions(options);
+ yomichan.on('optionsUpdate', () => this.updateOptions(null));
+ }
+
+ isPrepared() {
+ return this.options !== null;
+ }
+
onError(_error) {
throw new Error('Override me');
}
@@ -238,16 +248,6 @@ class Display {
throw new Error('Override me');
}
- isInitialized() {
- return this.options !== null;
- }
-
- async initialize(options=null) {
- await this.displayGenerator.prepare();
- await this.updateOptions(options);
- yomichan.on('optionsUpdate', () => this.updateOptions(null));
- }
-
async updateOptions(options) {
this.options = options ? options : await apiOptionsGet(this.getOptionsContext());
this.updateDocumentOptions(this.options);
@@ -358,7 +358,7 @@ class Display {
async setContentTerms(definitions, context, token) {
if (!context) { throw new Error('Context expected'); }
- if (!this.isInitialized()) { return; }
+ if (!this.isPrepared()) { return; }
this.setEventListenersActive(false);
@@ -419,7 +419,7 @@ class Display {
async setContentKanji(definitions, context, token) {
if (!context) { throw new Error('Context expected'); }
- if (!this.isInitialized()) { return; }
+ if (!this.isPrepared()) { return; }
this.setEventListenersActive(false);