SW-to-window communication
This commit is contained in:
parent
e3bf9a5185
commit
f449bfe2f1
2 changed files with 11 additions and 3 deletions
|
|
@ -82,9 +82,13 @@ function sendSubscriptionToBackEnd (subscription, token, notificationVisibility)
|
|||
return responseData
|
||||
})
|
||||
}
|
||||
export function initServiceWorker () {
|
||||
export async function initServiceWorker () {
|
||||
if (!isSWSupported()) return
|
||||
getOrCreateServiceWorker()
|
||||
await getOrCreateServiceWorker()
|
||||
navigator.serviceWorker.addEventListener('message', (event) => {
|
||||
console.log('SW MESSAGE', event)
|
||||
// TODO actually act upon click (open drawer on mobile for now)
|
||||
})
|
||||
}
|
||||
|
||||
export async function showDesktopNotification (content) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue