trivial-deferred
Version:
The most dead-simple trivial Deferred implementation
22 lines • 453 B
JavaScript
/**
* A handle around a Promise, so it may be resolved or
* rejected from outside the Promise constructor.
*/
export class Deferred {
/**
* Resolve the promise
*/
resolve;
/**
* Reject the promise
*/
reject;
/**
* The promise that gets resolved or rejected
*/
promise = new Promise((res, rej) => {
this.resolve = res;
this.reject = rej;
});
}
//# sourceMappingURL=index.js.map