aboutsummaryrefslogtreecommitdiff
path: root/node_modules/@calebboyd/semaphore/deferred.js
blob: a096b92827af4833e5a6ba340905116434d49c7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function createDeferredFactory(PromiseCtor) {
    if (PromiseCtor === void 0) { PromiseCtor = Promise; }
    return function deferred() {
        var deferred = {};
        var promise = new PromiseCtor(function (resolve, reject) {
            deferred.resolve = resolve;
            deferred.reject = reject;
        });
        deferred.promise = promise;
        return deferred;
    };
}
exports.createDeferredFactory = createDeferredFactory;
exports.createDeferred = createDeferredFactory();