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.05 kB
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); import TUIRoomEngine__default, { TUIRequestAction, TUIRoomEvents } from "@tencentcloud/tuiroom-engine-js"; import useRoomEngine from "../../hooks/useRoomEngine.mjs"; const roomEngine = useRoomEngine(); 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 TUIRequestAction.kRequestToTakeSeat: this.store.addSeatApplicationRequest(eventInfo.request); break; case 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 TUIRequestAction.kRequestToTakeSeat: this.store.removeSeatApplicationRequest(eventInfo.request); break; case 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 TUIRequestAction.kRequestToTakeSeat: this.store.removeSeatApplicationRequest(eventInfo.request); break; case TUIRequestAction.kRequestRemoteUserOnSeat: this.store.setSeatInvitationRequest(null); break; } } bindRoomEngineEvents() { TUIRoomEngine__default.once("ready", () => { var _a, _b, _c; (_a = roomEngine.instance) == null ? void 0 : _a.on( TUIRoomEvents.onRequestReceived, this.onRequestReceived ); (_b = roomEngine.instance) == null ? void 0 : _b.on( TUIRoomEvents.onRequestCancelled, this.onRequestCancelled ); (_c = roomEngine.instance) == null ? void 0 : _c.on( TUIRoomEvents.onRequestProcessed, this.onRequestProcessed ); }); } }; __publicField(_RequestEventManager, "instance"); let RequestEventManager = _RequestEventManager; export { RequestEventManager as default };