try to fix the "website updated in background" notification
This commit is contained in:
parent
51f1f05b2d
commit
bcdf336242
@ -73,13 +73,16 @@ const showPushNotification = async (event) => {
|
|||||||
const res = prepareNotificationObject(parsedNotification, i18n)
|
const res = prepareNotificationObject(parsedNotification, i18n)
|
||||||
|
|
||||||
if (state.allowedNotificationTypes.has(parsedNotification.type)) {
|
if (state.allowedNotificationTypes.has(parsedNotification.type)) {
|
||||||
self.registration.showNotification(res.title, res)
|
return self.registration.showNotification(res.title, res)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return Promise.resolve()
|
||||||
}
|
}
|
||||||
|
|
||||||
self.addEventListener('push', async (event) => {
|
self.addEventListener('push', async (event) => {
|
||||||
if (event.data) {
|
if (event.data) {
|
||||||
|
// Supposedly, we HAVE to return a promise inside waitUntil otherwise it will
|
||||||
|
// show (extra) notification that website is updated in background
|
||||||
event.waitUntil(showPushNotification(event))
|
event.waitUntil(showPushNotification(event))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user