diff options
| author | Henry Jameson <me@hjkos.com> | 2023-12-13 18:36:16 +0200 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2023-12-13 18:36:16 +0200 |
| commit | bcdf336242307a149ab295a760d7b8851063f446 (patch) | |
| tree | 9b695c8a7a2d364a7043a800e7a44758521260f5 | |
| parent | 51f1f05b2d17ac1b1471d84481683909c61c373e (diff) | |
try to fix the "website updated in background" notification
| -rw-r--r-- | src/sw.js | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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)) } }) |
