trisquel-icecat/icecat/dom/notification/test/mochitest/notification_show_sw.js
2025-10-06 02:35:48 -06:00

13 lines
331 B
JavaScript

onmessage = async ev => {
if (ev.data !== "show") {
return;
}
const shown = await self.registration.showNotification("title").then(
() => true,
() => false
);
const clients = await self.clients.matchAll({ includeUncontrolled: true });
for (let client of clients) {
client.postMessage({ shown });
}
};