fix: uncaught promise on getOS causes event to end early
This commit is contained in:
parent
a895a91277
commit
1cbf5ab871
@ -236,7 +236,7 @@ export function onMessage (sw) {
|
|||||||
messageChannelPort = event.ports[0]
|
messageChannelPort = event.ports[0]
|
||||||
}
|
}
|
||||||
log('[sw:message] received message', 'info', { action: event.data.action })
|
log('[sw:message] received message', 'info', { action: event.data.action })
|
||||||
const currentOS = await getOS()
|
const currentOS = event.waitUntil(getOS())
|
||||||
log('[sw:message] stored os: ' + currentOS, 'info', { action: event.data.action })
|
log('[sw:message] stored os: ' + currentOS, 'info', { action: event.data.action })
|
||||||
if (event.data.action === STORE_SUBSCRIPTION) {
|
if (event.data.action === STORE_SUBSCRIPTION) {
|
||||||
log('[sw:message] storing subscription in IndexedDB', 'info', { endpoint: event.data.subscription.endpoint })
|
log('[sw:message] storing subscription in IndexedDB', 'info', { endpoint: event.data.subscription.endpoint })
|
||||||
@ -253,8 +253,8 @@ export function onMessage (sw) {
|
|||||||
promises.push(sw.registration.getNotifications().then((notifications) => {
|
promises.push(sw.registration.getNotifications().then((notifications) => {
|
||||||
notifications.forEach(notification => notification.close())
|
notifications.forEach(notification => notification.close())
|
||||||
}))
|
}))
|
||||||
activeCount = 0
|
|
||||||
promises.push(clearAppBadge(sw))
|
promises.push(clearAppBadge(sw))
|
||||||
|
activeCount = 0
|
||||||
event.waitUntil(Promise.all(promises))
|
event.waitUntil(Promise.all(promises))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user