UNPKG

sleeveforarm

Version:
33 lines 883 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class PromiseGate { constructor() { this.gatePromise = new Promise((resolve, reject) => { this.resolve = resolve; this.reject = reject; }); this.gateOpen = false; } get promise() { return this.gatePromise; } get isGateOpen() { return this.gateOpen; } openGateSuccess(...theArgs) { this.openGateInfra(); this.resolve(...theArgs); } openGateError(...theErrors) { this.openGateInfra(); this.reject(...theErrors); } openGateInfra() { if (this.gateOpen) { throw new Error("Gate was already opened!"); } this.gateOpen = true; } } exports.default = PromiseGate; //# sourceMappingURL=promiseGate.js.map