aboutsummaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
authorEgor Kislitsyn <egor@kislitsyn.com>2018-12-13 00:03:50 +0700
committerEgor Kislitsyn <egor@kislitsyn.com>2018-12-13 00:03:50 +0700
commit02c0e15781fa0a499c736e710755e799bfaec77d (patch)
tree0defdd796fb4e42e0e228d912622a6bbcc67db89 /static
parentee70ec4c7efb49c08f0a76b6b2694c0e9910978c (diff)
add checkbox to disable web push
Diffstat (limited to 'static')
-rw-r--r--static/sw.js29
1 files changed, 0 insertions, 29 deletions
diff --git a/static/sw.js b/static/sw.js
deleted file mode 100644
index d51870d5..00000000
--- a/static/sw.js
+++ /dev/null
@@ -1,29 +0,0 @@
-/* eslint-env serviceworker */
-
-function getWindowClients () {
- return clients.matchAll({ includeUncontrolled: true })
- .then((clientList) => clientList.filter(({ type }) => type === 'window'))
-}
-
-self.addEventListener('push', (event) => {
- if (event.data) {
- event.waitUntil(getWindowClients().then((list) => {
- const data = event.data.json()
-
- if (list.length === 0) return self.registration.showNotification(data.title, data)
- }))
- }
-})
-
-self.addEventListener('notificationclick', (event) => {
- event.notification.close()
-
- event.waitUntil(getWindowClients().then((list) => {
- for (var i = 0; i < list.length; i++) {
- var client = list[i]
- if (client.url === '/' && 'focus' in client) { return client.focus() }
- }
-
- if (clients.openWindow) return clients.openWindow('/')
- }))
-})