UNPKG

trivial-deferred

Version:

The most dead-simple trivial Deferred implementation

20 lines 528 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Deferred = void 0; /** * A handle around a Promise, so it may be resolved or * rejected from outside the Promise constructor. */ class Deferred { constructor() { /** * The promise that gets resolved or rejected */ this.promise = new Promise((res, rej) => { this.resolve = res; this.reject = rej; }); } } exports.Deferred = Deferred; //# sourceMappingURL=index.js.map