@simplito/privmx-webendpoint
Version:
PrivMX Web Endpoint library
34 lines (31 loc) • 998 B
JavaScript
;
/*!
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;
deferedPromise;
constructor(native, ptr) {
super(ptr);
this.native = native;
}
async waitEvent() {
if (!this.deferedPromise) {
this.deferedPromise = this.native.waitEvent(this.servicePtr, []);
this.deferedPromise.finally(() => (this.deferedPromise = null));
}
return this.deferedPromise;
}
async emitBreakEvent() {
return this.native.emitBreakEvent(this.servicePtr, []);
}
}
exports.EventQueue = EventQueue;