service-worker.js 876 B

1234567891011121314151617181920212223242526
  1. // Add a service worker for processing Web Push notifications:
  2. //
  3. // self.addEventListener("push", async (event) => {
  4. // const { title, options } = await event.data.json()
  5. // event.waitUntil(self.registration.showNotification(title, options))
  6. // })
  7. //
  8. // self.addEventListener("notificationclick", function(event) {
  9. // event.notification.close()
  10. // event.waitUntil(
  11. // clients.matchAll({ type: "window" }).then((clientList) => {
  12. // for (let i = 0; i < clientList.length; i++) {
  13. // let client = clientList[i]
  14. // let clientPath = (new URL(client.url)).pathname
  15. //
  16. // if (clientPath == event.notification.data.path && "focus" in client) {
  17. // return client.focus()
  18. // }
  19. // }
  20. //
  21. // if (clients.openWindow) {
  22. // return clients.openWindow(event.notification.data.path)
  23. // }
  24. // })
  25. // )
  26. // })