aboutsummaryrefslogtreecommitdiff
path: root/src/sw.js
diff options
context:
space:
mode:
authorHenry Jameson <me@hjkos.com>2023-12-13 18:36:16 +0200
committerHenry Jameson <me@hjkos.com>2023-12-13 18:36:16 +0200
commitbcdf336242307a149ab295a760d7b8851063f446 (patch)
tree9b695c8a7a2d364a7043a800e7a44758521260f5 /src/sw.js
parent51f1f05b2d17ac1b1471d84481683909c61c373e (diff)
try to fix the "website updated in background" notification
Diffstat (limited to 'src/sw.js')
-rw-r--r--src/sw.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/sw.js b/src/sw.js
index 469291b9..86f6e694 100644
--- a/src/sw.js
+++ b/src/sw.js
@@ -73,13 +73,16 @@ const showPushNotification = async (event) => {
const res = prepareNotificationObject(parsedNotification, i18n)
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) => {
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))
}
})