fix(core): update

This commit is contained in:
2020-09-19 15:06:27 +00:00
parent 995ae20502
commit b00db37bf4
2 changed files with 4 additions and 5 deletions

View File

@@ -18,7 +18,8 @@ export class WebStore<T = any> {
public async init() {
if (this.initCalled) {
return this.readyDeferred.promise;
await this.readyDeferred.promise;
return;
}
this.initCalled = true;
this.db = await plugins.idb.openDB(this.options.dbName, 1, {
@@ -27,6 +28,7 @@ export class WebStore<T = any> {
},
});
this.readyDeferred.resolve();
return;
}
async get(key: string): Promise<T> {
@@ -41,6 +43,7 @@ export class WebStore<T = any> {
}
async set(key: string, val: T) {
await this.init();
return this.db.put(this.options.storeName, val, key);
}