fix async issues

This commit is contained in:
siikamiika 2020-02-10 22:09:23 +02:00
parent 4f1ed14f07
commit 9c98c631af
3 changed files with 7 additions and 2 deletions

View File

@ -20,10 +20,9 @@
class QueryParserGenerator {
constructor() {
this._templateHandler = null;
this._initialize();
}
async _initialize() {
async prepare() {
const html = await apiGetQueryParserTemplatesHtml();
this._templateHandler = new TemplateHandler(html);
}

View File

@ -31,6 +31,10 @@ class QueryParser extends TextScanner {
this.queryParserGenerator = new QueryParserGenerator();
}
async prepare() {
await this.queryParserGenerator.prepare();
}
onError(error) {
logError(error, false);
}

View File

@ -49,6 +49,8 @@ class DisplaySearch extends Display {
try {
await this.initialize();
await this.queryParser.prepare();
const {queryParams: {query='', mode=''}} = parseUrl(window.location.href);
if (this.search !== null) {