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/bg/js/search.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ext/bg') diff --git a/ext/bg/js/search.js b/ext/bg/js/search.js index 6641255f..86ed675a 100644 --- a/ext/bg/js/search.js +++ b/ext/bg/js/search.js @@ -47,7 +47,7 @@ class DisplaySearch extends Display { async prepare() { try { - await this.initialize(); + await super.prepare(); await this.queryParser.prepare(); -- cgit v1.2.3 From d7e1ef01d8af4a315a31364eb5138e24a132ea1e Mon Sep 17 00:00:00 2001 From: siikamiika Date: Thu, 13 Feb 2020 16:26:45 +0200 Subject: use Promise.all to await dependencies --- ext/bg/js/search.js | 6 +++--- ext/mixed/js/display.js | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'ext/bg') diff --git a/ext/bg/js/search.js b/ext/bg/js/search.js index 86ed675a..bb27205c 100644 --- a/ext/bg/js/search.js +++ b/ext/bg/js/search.js @@ -47,9 +47,9 @@ class DisplaySearch extends Display { async prepare() { try { - await super.prepare(); - - await this.queryParser.prepare(); + const superPromise = super.prepare(); + const queryParserPromise = this.queryParser.prepare(); + await Promise.all([superPromise, queryParserPromise]); const {queryParams: {query='', mode=''}} = parseUrl(window.location.href); diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js index b524fe34..d49c205e 100644 --- a/ext/mixed/js/display.js +++ b/ext/mixed/js/display.js @@ -44,8 +44,9 @@ class Display { } async prepare(options=null) { - await this.displayGenerator.prepare(); - await this.updateOptions(options); + const displayGeneratorPromise = this.displayGenerator.prepare(); + const updateOptionsPromise = this.updateOptions(options); + await Promise.all([displayGeneratorPromise, updateOptionsPromise]); yomichan.on('optionsUpdate', () => this.updateOptions(null)); } -- cgit v1.2.3