Files
testing-tool/utils/messages.tsx
T
雨霖铃 c848003214 feat(recorder): 实现IndexedDB分块存储录制事件
- 将录制状态中的events数组替换为sessionId,避免内存溢出问题
- 集成IndexedDB工具模块实现事件分块存储功能
- 修改开始录制逻辑以生成会话ID并初始化数据库会话
- 更新停止录制逻辑从数据库流式读取事件并删除会话数据
- 修复content:save-track-events消息类型的拼写错误
- 在RoutePersistence组件中添加路由恢复和保存的成功提示
- 重构popup应用CSS样式文件,移除冗余导航样式代码
2026-02-21 15:27:30 +08:00

57 lines
1.6 KiB
TypeScript

import { defineExtensionMessaging } from '@webext-core/messaging';
export const messages = {
popup: {
from: {
start: 'popup:start',
stop: 'popup:stop',
},
to: {
stopped: 'popup:stopped',
started: 'popup:started',
tabChanged: 'popup:tab-changed',
},
checkStatus: 'popup:check-status',
ready: 'popup:ready',
},
content: {
from: {
saveTrackEvents: 'content:save-track-events',
},
to: {
startRecording: 'content:start-recording',
stopRecording: 'content:stop-recording',
},
checkStatus: 'content:check-status',
},
offscreen: {
to: {
startRecording: 'offscreen:start-recording',
stopRecording: 'offscreen:stop-recording',
},
},
};
interface ProtocolMap {
// --- Popup 相关 ---
'popup:start': () => { ok: boolean; error?: string };
'popup:stop': () => { ok: boolean; error?: string };
'popup:started': () => void;
'popup:stopped': () => void;
'popup:tab-changed': (data: { currentTabId: number; recordingTabId: number | undefined }) => void;
'popup:check-status': () => { active: boolean; startTime?: number };
'popup:ready': () => void;
// --- Content 相关 ---
'content:save-track-events': (event: unknown) => boolean;
'content:start-recording': () => { ok: boolean; error?: string };
'content:stop-recording': () => { ok: boolean };
'content:check-status': () => boolean;
// --- Offscreen 相关 ---
'offscreen:start-recording': (streamId: string) => void;
'offscreen:stop-recording': () => void;
}
export const { sendMessage, onMessage } = defineExtensionMessaging<ProtocolMap>();