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,

87 lines (86 loc) 2.46 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 logger from "../../utils/common/logger/index.mjs"; const componentNames = [ "SwitchTheme", "LayoutControl", "RoomInfo", "RoomLink", "Language", "UserInfo", "ScreenShare", "FullScreen", "ManageMemberControl", "InviteControl", "ChatControl", "MoreControl", "VirtualBackground", "BasicBeauty", "AIControl" ]; const logPrefix = "[RoomService ComponentManager]"; const defaultConfig = { SwitchTheme: { visible: true }, LayoutControl: { visible: true }, RoomInfo: { visible: true }, RoomLink: { visible: true }, Language: { visible: true }, UserInfo: { visible: true }, ScreenShare: { visible: true }, FullScreen: { visible: true }, ManageMemberControl: { visible: true }, InviteControl: { visible: true }, ChatControl: { visible: true }, MoreControl: { visible: true }, VirtualBackground: { visible: false }, AIControl: { visible: false }, BasicBeauty: { visible: true } }; const _ComponentManager = class _ComponentManager { constructor(service) { __publicField(this, "service"); __publicField(this, "componentConfig", Object.fromEntries( componentNames.map((name) => [ name, { ...defaultConfig[name] } ]) )); this.service = service; } static getInstance(ctx) { if (!_ComponentManager.instance) { _ComponentManager.instance = new _ComponentManager(ctx); } return _ComponentManager.instance; } static destroyInstance() { if (!_ComponentManager.instance) return; _ComponentManager.instance = void 0; } getComponentConfig(name) { return this.componentConfig[name]; } setComponentConfig(options) { try { Object.entries(options).forEach(([name, current]) => { this.componentConfig[name] = Object.assign( {}, this.componentConfig[name], current ); }); return true; } catch (error) { logger.error(`${logPrefix}setComponentConfig error: ${error}`); return false; } } }; __publicField(_ComponentManager, "instance"); let ComponentManager = _ComponentManager; export { ComponentManager };