fix(core): update
This commit is contained in:
parent
56b8581d2b
commit
765356ce3d
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/smartdata',
|
||||
version: '5.0.37',
|
||||
version: '5.0.38',
|
||||
description: 'do more with data'
|
||||
}
|
||||
|
@ -37,7 +37,16 @@ export class EasyStore<T> {
|
||||
this.nameId = nameIdArg;
|
||||
}
|
||||
|
||||
private async getEasyStore() {
|
||||
private easyStorePromise: Promise<InstanceType<typeof this.easyStoreClass>>;
|
||||
private async getEasyStore(): Promise<InstanceType<typeof this.easyStoreClass>> {
|
||||
if (this.easyStorePromise) {
|
||||
return this.easyStorePromise;
|
||||
};
|
||||
|
||||
// first run from here
|
||||
const deferred = plugins.smartpromise.defer<InstanceType<typeof this.easyStoreClass>>();
|
||||
this.easyStorePromise = deferred.promise;
|
||||
|
||||
let easyStore = await this.easyStoreClass.getInstance({
|
||||
nameId: this.nameId,
|
||||
});
|
||||
@ -48,7 +57,8 @@ export class EasyStore<T> {
|
||||
easyStore.data = {};
|
||||
await easyStore.save();
|
||||
}
|
||||
return easyStore;
|
||||
deferred.resolve(easyStore);
|
||||
return this.easyStorePromise;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user