```
refactor(storage): 将storage工具类重命名为chromeStorage 重命名utils/storage.ts为utils/chromeStorage.ts以更好地反映其功能用途 feat(messages): 简化消息协议定义并移除过时的消息类型 将messages.tsx中的硬编码消息对象替换为ProtocolMap接口定义, 移除了不再使用的popup、content和offscreen相关消息类型, 使消息系统更加简洁和类型安全 ```
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { useEffect, useRef } from 'react';
|
||||
import { useLocation, useNavigate } from 'react-router-dom';
|
||||
import { storage } from '@/utils/storage';
|
||||
import { storage } from '@/utils/chromeStorage';
|
||||
|
||||
const RoutePersistence = () => {
|
||||
const location = useLocation();
|
||||
|
||||
@@ -1,37 +1,5 @@
|
||||
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 };
|
||||
|
||||
Reference in New Issue
Block a user