UNPKG

nest-nsq-transport

Version:
26 lines 651 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.WaitGroup = void 0; const deferred_1 = require("./deferred"); class WaitGroup { deferred = new deferred_1.Deferred(); count = 0; waiting = false; add(x) { this.count += x; } done() { this.count--; if (this.waiting && this.count <= 0) { this.deferred.resolve(); } } async wait() { this.waiting = true; if (this.count <= 0) this.deferred.resolve(); return this.deferred.promise; } } exports.WaitGroup = WaitGroup; //# sourceMappingURL=wait-group.js.map