MCPcopy Create free account
hub / github.com/Wscats/chrome-devtools-cli / handshake

Function handshake

src/core/content.ts:1–13  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

1const 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 的通信
16window.addEventListener('message', handshake);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected