self.addEventListener("push", (event) => {
const obj = event.data.json();
if (obj.action === "subscribe" || obj.action === "unsubscribe") {
fireNotification(obj, event);
port.postMessage(obj);
} else if (obj.action === "init" || obj.action === "chatMsg") {
port.postMessage(obj);
}
});PushMessageData / notebook
PushMessageData
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.