feat: 更新背景脚本和内容脚本,添加录制控制消息处理,优化录制状态检查逻辑,新增消息常量
This commit is contained in:
+23
-2
@@ -1,6 +1,27 @@
|
||||
// import { useRecorder } from '../hooks/useRecorder';
|
||||
|
||||
export default defineContentScript({
|
||||
matches: ['*://*.google.com/*'],
|
||||
// matches: ['*://*.google.com/*'],
|
||||
matches: ['<all_urls>'],
|
||||
runAt: 'document_start',
|
||||
main() {
|
||||
console.log('Hello content.');
|
||||
console.log('Content script loaded successfully', { id: browser.runtime.id });
|
||||
|
||||
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
|
||||
if (message.type === 'START_RECORD') {
|
||||
// startRecord();
|
||||
console.log('Start recording command received in content script');
|
||||
sendResponse({ status: 'Recording started' });
|
||||
} else if (message.type === 'STOP_RECORD') {
|
||||
// stopRecord();
|
||||
console.log('Stop recording command received in content script');
|
||||
sendResponse({ status: 'Recording stopped' });
|
||||
} else {
|
||||
console.log('Unknown command received in content script');
|
||||
sendResponse({ status: 'Unknown command' });
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user