(e)
| 1 | const handshake = (e) => { |
| 2 | // 断开 inject.ts 和 content.ts 的通信 |
| 3 | if (e.data.payload === 'shutdown') { |
| 4 | window.removeEventListener('message', handshake); |
| 5 | } |
| 6 | try { |
| 7 | chrome.runtime.sendMessage(e.data, function(response) { |
| 8 | console.log('收到来自后台的回复:' + response); |
| 9 | }); |
| 10 | } catch (error) { |
| 11 | console.log(error); |
| 12 | } |
| 13 | }; |
| 14 | |
| 15 | // inject.ts 和 content.ts 的通信 |
| 16 | window.addEventListener('message', handshake); |
nothing calls this directly
no outgoing calls
no test coverage detected