Fixed circular reference #2

This commit is contained in:
Sebastian Seedorf
2020-11-19 23:04:36 +01:00
parent 91ba224f79
commit 8dc481b551
3 changed files with 15 additions and 5 deletions

View File

@@ -23,8 +23,12 @@ class FetchOnce {
this.state = ResolvableState.WAITING;
this.pendings = [];
}
reset() {
this.data = undefined;
this.error = undefined;
this.state = ResolvableState.WAITING;
}
resolve(...args) {
// eslint-disable-next-line promise/avoid-new
return new Promise((resolve, reject) => {
switch (this.state) {
case ResolvableState.WAITING:
@@ -81,5 +85,9 @@ class WaitForSync extends FetchOnce {
this.parsePromise((() => __awaiter(this, void 0, void 0, function* () { throw error; }))());
}
}
reset() {
super.reset();
this.state = ResolvableState.PENDING;
}
}
exports.WaitForSync = WaitForSync;