blob: 1b69a8bdf94cc6d52a1ce13c31a38dcbc456c340 [file]
onmessage = (e) => {
if (e.data == "check-initial-permission" || e.data == "check-permission-granted") {
self.postMessage(Notification.permission);
return;
}
if (e.data == "show-notification") {
notification = new Notification("foo");
timeoutHandle = setTimeout(() => {
self.postMessage("timeout");
}, 10000);
notification.onshow = (e) => {
clearTimeout(timeoutHandle);
self.postMessage("shown");
};
notification.onerror = (e) => {
clearTimeout(timeoutHandle);
self.postMessage("error");
};
}
};