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,

66 lines (55 loc) 1.39 kB
import TUIRoomEngine from '@tencentcloud/tuiroom-engine-js'; const KEY_METRICS_API = 'KeyMetricsStats'; export enum MetricsKey { startSharingWhiteboard = 106000, stopSharingWhiteboard = 106001, startAnnotating = 106002, stopAnnotating = 106003, saveWhiteboard = 106004, setLanguage = 106050, setTheme = 106051, disableTextMessaging = 106052, disableScreenSharing = 106053, enableWatermark = 106054, enableVirtualBackground = 106055, hideFeatureButton = 106056, openChat = 106057, setBasicBeauty = 106058, aiTask = 106059, } type Task = () => void; export class DataReportManager { private taskQueue: Task[] = []; private isReady = false; constructor() { this.bindEvent(); } public reportCount(key: MetricsKey) { const task = this.createReportCountTask(key); if (!this.isReady) { this.taskQueue.push(task); } else { task(); } } private bindEvent() { TUIRoomEngine.once('ready', () => { this.isReady = true; this.executePendingTasks(); }); } private executePendingTasks() { this.taskQueue.forEach(task => task()); this.taskQueue = []; } private createReportCountTask(key: MetricsKey): Task { return () => { TUIRoomEngine.callExperimentalAPI( JSON.stringify({ api: KEY_METRICS_API, params: { key }, }) ); }; } }