Close notification early

Not sure if this would make a difference but possibly fix some bugs
This commit is contained in:
Lim Chee Aun 2023-10-15 16:25:04 +08:00
parent 6540dd5642
commit 8cf30773ce

View file

@ -163,6 +163,7 @@ self.addEventListener('notificationclick', (event) => {
const { access_token, notification_type } = data; const { access_token, notification_type } = data;
const url = `/#/notifications?id=${tag}&access_token=${btoa(access_token)}`; const url = `/#/notifications?id=${tag}&access_token=${btoa(access_token)}`;
event.notification.close();
event.waitUntil( event.waitUntil(
(async () => { (async () => {
const clients = await self.clients.matchAll({ const clients = await self.clients.matchAll({
@ -194,7 +195,6 @@ self.addEventListener('notificationclick', (event) => {
console.log('NOTIFICATION CLICK openWindow', url); console.log('NOTIFICATION CLICK openWindow', url);
await self.clients.openWindow(url); await self.clients.openWindow(url);
} }
await event.notification.close();
})(), })(),
); );
}); });