From df37acd17f9459c17185552f11dc4cc424e01958 Mon Sep 17 00:00:00 2001 From: siikamiika Date: Thu, 13 Feb 2020 01:59:26 +0200 Subject: rename display initialize methods to prepare --- ext/mixed/js/display.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'ext/mixed/js') 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); -- cgit v1.2.3