use Promise.all to await dependencies
This commit is contained in:
parent
38a6433a46
commit
d7e1ef01d8
@ -47,9 +47,9 @@ class DisplaySearch extends Display {
|
|||||||
|
|
||||||
async prepare() {
|
async prepare() {
|
||||||
try {
|
try {
|
||||||
await super.prepare();
|
const superPromise = super.prepare();
|
||||||
|
const queryParserPromise = this.queryParser.prepare();
|
||||||
await this.queryParser.prepare();
|
await Promise.all([superPromise, queryParserPromise]);
|
||||||
|
|
||||||
const {queryParams: {query='', mode=''}} = parseUrl(window.location.href);
|
const {queryParams: {query='', mode=''}} = parseUrl(window.location.href);
|
||||||
|
|
||||||
|
@ -44,8 +44,9 @@ class Display {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async prepare(options=null) {
|
async prepare(options=null) {
|
||||||
await this.displayGenerator.prepare();
|
const displayGeneratorPromise = this.displayGenerator.prepare();
|
||||||
await this.updateOptions(options);
|
const updateOptionsPromise = this.updateOptions(options);
|
||||||
|
await Promise.all([displayGeneratorPromise, updateOptionsPromise]);
|
||||||
yomichan.on('optionsUpdate', () => this.updateOptions(null));
|
yomichan.on('optionsUpdate', () => this.updateOptions(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user