inceptum
Version:
hipages take on the foundational library for enterprise-grade apps written in NodeJS
28 lines • 840 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ReadyGate = void 0;
class ReadyGate {
async awaitChannelReady() {
if (this.channelReadyPromise) {
await this.channelReadyPromise;
}
}
isChannelReady() {
return this.channelReadyPromise === undefined;
}
channelNotReady() {
if (!this.channelReadyPromise) {
this.channelReadyPromise = new Promise((resolve) => {
this.channelReadyPromiseResolve = resolve;
});
}
}
channelReady() {
if (this.channelReadyPromise && this.channelReadyPromiseResolve) {
this.channelReadyPromiseResolve();
this.channelReadyPromise = undefined;
}
}
}
exports.ReadyGate = ReadyGate;
//# sourceMappingURL=ReadyGate.js.map