Initial commit: Club DynaSQY
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { precacheAndRoute } from 'workbox-precaching'
|
||||
|
||||
precacheAndRoute(self.__WB_MANIFEST)
|
||||
|
||||
self.addEventListener('push', (event) => {
|
||||
let data = { title: 'Dyna Biz Coignières', body: '' }
|
||||
try {
|
||||
if (event.data) data = event.data.json()
|
||||
} catch {}
|
||||
const options = {
|
||||
body: data.body,
|
||||
icon: data.icon || '/logo.svg',
|
||||
badge: data.badge || '/favicon.svg',
|
||||
data: { url: data.data?.url || '/' },
|
||||
}
|
||||
event.waitUntil(self.registration.showNotification(data.title, options))
|
||||
})
|
||||
|
||||
self.addEventListener('notificationclick', (event) => {
|
||||
event.notification.close()
|
||||
const url = event.notification.data?.url || '/'
|
||||
event.waitUntil(clients.openWindow(url))
|
||||
})
|
||||
Reference in New Issue
Block a user