@fbltd/async
Version:
Miscellaneous async utils
31 lines (30 loc) • 682 B
JavaScript
export class PromiseConfiguration {
promise;
_resolve;
_reject;
_isFulfilled = false;
constructor() {
this.promise = new Promise((res, rej) => {
this._resolve = ((value) => {
res(value);
this._isFulfilled = true;
});
this._reject = (error) => {
rej(error);
this._isFulfilled = true;
};
});
}
get reject() {
return this._reject;
}
get resolve() {
return this._resolve;
}
get isFulfilled() {
return this._isFulfilled;
}
get isPending() {
return !this.isFulfilled;
}
}