UNPKG

@simplito/privmx-webendpoint

Version:

PrivMX Web Endpoint library

38 lines (35 loc) 1.05 kB
"use strict"; /*! PrivMX Web Endpoint. Copyright © 2024 Simplito sp. z o.o. This file is part of the PrivMX Platform (https://privmx.dev). This software is Licensed under the PrivMX Free License. See the License for the specific language governing permissions and limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.EventQueue = void 0; const BaseApi_1 = require("./BaseApi"); class EventQueue extends BaseApi_1.BaseApi { native; isPending = false; constructor(native, ptr) { super(ptr); this.native = native; } async waitEvent() { if (this.isPending) { throw ("WaitEvent() is already in a pending state waiting for new events"); } try { return await this.native.waitEvent(this.servicePtr, []); } finally { this.isPending = false; } } async emitBreakEvent() { return this.native.emitBreakEvent(this.servicePtr, []); } } exports.EventQueue = EventQueue;