feat: 优化消息处理逻辑,添加录制开始和停止的消息处理,删除未使用的 chromeUtils 文件
This commit is contained in:
+13
-2
@@ -8,10 +8,21 @@ export default defineContentScript({
|
||||
// 监听来自 background script 的消息
|
||||
chrome.runtime.onMessage.addListener((msg: { type: string }, _sender, sendResponse) => {
|
||||
if (msg.type === messages.content.checkStatus) {
|
||||
// 检查状态的处理逻辑
|
||||
console.log('[content] checkStatus received');
|
||||
sendResponse({ ok: true });
|
||||
} else {
|
||||
console.log('[content] unknown message type:', msg.type);
|
||||
}
|
||||
|
||||
if (msg.type === messages.content.to.startRecording) {
|
||||
// 开始录制的处理逻辑
|
||||
console.log('[content] startRecording received');
|
||||
sendResponse({ ok: true });
|
||||
}
|
||||
|
||||
if (msg.type === messages.content.to.stopRecording) {
|
||||
// 停止录制的处理逻辑
|
||||
console.log('[content] stopRecording received');
|
||||
sendResponse({ ok: true });
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user