Skip to content

Commit

Permalink
Improve async
Browse files Browse the repository at this point in the history
  • Loading branch information
Kartik Raj committed Jul 17, 2023
1 parent f531b28 commit 2047861
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/client/common/utils/async.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,17 @@ class DeferredImpl<T> implements Deferred<T> {
}

public resolve(_value: T | PromiseLike<T>) {
if (this.completed) {
return;
}
this._resolve.apply(this.scope ? this.scope : this, [_value]);
this._resolved = true;
}

public reject(_reason?: string | Error | Record<string, unknown>) {
if (this.completed) {
return;
}
this._reject.apply(this.scope ? this.scope : this, [_reason]);
this._rejected = true;
}
Expand Down

0 comments on commit 2047861

Please sign in to comment.