UNPKG

@tencentcloud/roomkit-web-vue3

Version:

<h1 align="center"> TUIRoomKit</h1> Conference (TUIRoomKit) is a product suitable for multi-person audio and video conversation scenarios such as business meetings, webinars, and online education. By integrating this product, you can add room management,

81 lines (80 loc) 3.26 kB
"use strict"; var __defProp = Object.defineProperty; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); const TUIRoomEngine = require("@tencentcloud/tuiroom-engine-js"); const useRoomEngine = require("../../hooks/useRoomEngine.js"); const roomEngine = useRoomEngine.default(); const _RequestEventManager = class _RequestEventManager { constructor(options) { __publicField(this, "store"); if (!_RequestEventManager.instance) { _RequestEventManager.instance = this; } this.store = options.store; this.onRequestReceived = this.onRequestReceived.bind(this); this.onRequestCancelled = this.onRequestCancelled.bind(this); this.onRequestProcessed = this.onRequestProcessed.bind(this); this.bindRoomEngineEvents(); return _RequestEventManager.instance; } onRequestReceived(eventInfo) { const { userId, requestAction } = eventInfo.request; if (!this.store.getUserInfo(userId)) { return; } switch (requestAction) { case TUIRoomEngine.TUIRequestAction.kRequestToTakeSeat: this.store.addSeatApplicationRequest(eventInfo.request); break; case TUIRoomEngine.TUIRequestAction.kRequestRemoteUserOnSeat: this.store.setSeatInvitationRequest(eventInfo.request); break; } } // The remote user cancels the application to connect to the stage onRequestCancelled(eventInfo) { const { requestAction } = eventInfo.request; switch (requestAction) { case TUIRoomEngine.TUIRequestAction.kRequestToTakeSeat: this.store.removeSeatApplicationRequest(eventInfo.request); break; case TUIRoomEngine.TUIRequestAction.kRequestRemoteUserOnSeat: this.store.setSeatInvitationRequest(null); break; } } // The remote user's request is handled by other administrators/hosts. onRequestProcessed(eventInfo) { const { requestAction } = eventInfo.request; switch (requestAction) { case TUIRoomEngine.TUIRequestAction.kRequestToTakeSeat: this.store.removeSeatApplicationRequest(eventInfo.request); break; case TUIRoomEngine.TUIRequestAction.kRequestRemoteUserOnSeat: this.store.setSeatInvitationRequest(null); break; } } bindRoomEngineEvents() { TUIRoomEngine.once("ready", () => { var _a, _b, _c; (_a = roomEngine.instance) == null ? void 0 : _a.on( TUIRoomEngine.TUIRoomEvents.onRequestReceived, this.onRequestReceived ); (_b = roomEngine.instance) == null ? void 0 : _b.on( TUIRoomEngine.TUIRoomEvents.onRequestCancelled, this.onRequestCancelled ); (_c = roomEngine.instance) == null ? void 0 : _c.on( TUIRoomEngine.TUIRoomEvents.onRequestProcessed, this.onRequestProcessed ); }); } }; __publicField(_RequestEventManager, "instance"); let RequestEventManager = _RequestEventManager; exports.default = RequestEventManager;