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() {
|
||||
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);
|
||||
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user