@creately/future
Version:
Extended version of the Promise class which has `resolve` and `reject` methods to resolve or reject the underlying promise.
20 lines • 510 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Creates a new Future instance by extending a new Promise instance.
*/
function createFuture() {
var res;
var rej;
var future = new Promise(function (_res, _rej) {
res = _res;
rej = _rej;
});
Object.defineProperties(future, {
resolve: { value: res },
reject: { value: rej },
});
return future;
}
exports.createFuture = createFuture;
//# sourceMappingURL=index.js.map