13 lines
411 B
JavaScript
13 lines
411 B
JavaScript
|
|
self.addEventListener("notificationclick", (event) => {
|
||
|
|
event.notification.close();
|
||
|
|
event.waitUntil(
|
||
|
|
self.clients.matchAll({ type: "window", includeUncontrolled: true }).then((clients) => {
|
||
|
|
for (const client of clients) {
|
||
|
|
if ("focus" in client) return client.focus();
|
||
|
|
}
|
||
|
|
if (self.clients.openWindow) return self.clients.openWindow("/");
|
||
|
|
return undefined;
|
||
|
|
}),
|
||
|
|
);
|
||
|
|
});
|