aboutsummaryrefslogtreecommitdiff
path: root/ext/mixed/js
diff options
context:
space:
mode:
authorsiikamiika <siikamiika@users.noreply.github.com>2020-02-13 01:59:26 +0200
committersiikamiika <siikamiika@users.noreply.github.com>2020-02-13 01:59:26 +0200
commitdf37acd17f9459c17185552f11dc4cc424e01958 (patch)
tree4d427883d97bb3d95cc42d17f780825b6b7c692f /ext/mixed/js
parent93eaee9765c7478ee5ad7485d664b86acf3d4510 (diff)
rename display initialize methods to prepare
Diffstat (limited to 'ext/mixed/js')
-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);