Files
testing-tool/utils/messages.tsx
T
雨霖铃 3ece5e2e96 fix: 修复 ESLint 配置及组件弃用属性警告,优化代码格式
1. 工程配置:
- 更新 tsconfig.json include 规则,解决 eslint.config.ts 未被包含的问题。

2. 组件重构 (Material UI 适配):
- Navbar: 替换已弃用的 PaperProps 为 slotProps.paper。
- TimestampToDatetime / DatetimeToTimestamp: 替换已弃用的 InputProps 为 slotProps.input。

3. 类型与逻辑修复:
- utils/recordUtils.tsx: 引入缺失依赖,忽略 UNSAFE_replayCanvas 等类型报错,修复构建问题。
- utils/messages.tsx: 完善事件参数类型定义。

4. 其他优化:
- 统一 App.css 代码格式。
- 补充部分组件 (CopyButton, TimestampExecution) 的 React 导入和类型定义。
2026-02-13 23:46:16 +08:00

55 lines
1.4 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',
},
checkStatus: 'popup:check-status',
ready: 'popup:ready',
},
content: {
from: {
saveTrackeEvents: 'content:save-tracke-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 };
'popup:stop': () => { ok: boolean };
'popup:started': () => void;
'popup:stopped': () => void;
'popup:check-status': () => { active: boolean; startTime?: number };
'popup:ready': () => void;
// --- Content 相关 ---
'content:save-tracke-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>();