-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcommonscript.js
More file actions
25 lines (18 loc) · 846 Bytes
/
Copy pathcommonscript.js
File metadata and controls
25 lines (18 loc) · 846 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// --------------------------------------------------------------------------
// COMMONSCRIPT.JS
// --------------------------------------------------------------------------
var port;
const INTERNAL_TESTAWAKE_PORT = "CT_Internal_awake_test";
// ---------------------------------------------------------------------------
// Waking up the ServiceWorker
// ---------------------------------------------------------------------------
function awakeServiceWorker() {
port = chrome.runtime.connect({name: INTERNAL_TESTAWAKE_PORT});
port.onDisconnect.addListener( (port) => {
console.log("Service Worker asked to disconnect");
})
port.onMessage.addListener( msg => {
console.log(`Message from service worker: ${msg}`);
});
}
// ---------------------------------------------------------------------------