i'm struggling with promises in a service worker while using async/await
syntax.
Following situation: I got a push notification and want to handle the click event. If i use the "old" syntax with then
and catch
i can iteratore over the list of clients and do something with it. If i use my prefered way with async/await
it wouldn't do anything.
self.addEventListener("notificationclick", event => {
// is working
event.waitUntil(self.clients.matchAll().then(clientList => {
console.log(clientList);
}));
// is not working
event.waitUntil(async () => {
const clientList = await self.clients.matchAll();
console.log(clientList);
});
});