Remove unnecessary await in push handler
We were `await`ing a synchronous method here, which will have the effect of deferring its execution, and thus also the `event.waitUntil` call. We want the latter to happen before control returns from the event. Removing the unnecessary `await` solves this. This seems unlikely to be a problem in practice, but all the same, it's not right :)
This commit is contained in:
@@ -9,8 +9,8 @@ self.addEventListener('fetch', (event) => {
|
||||
}
|
||||
})
|
||||
|
||||
self.addEventListener("push", async (event) => {
|
||||
const data = await event.data.json()
|
||||
self.addEventListener("push", (event) => {
|
||||
const data = event.data.json()
|
||||
event.waitUntil(Promise.all([ showNotification(data), updateBadgeCount(data.options) ]))
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user