fix chrome "this site has been updated in the background" message

This commit is contained in:
Thibault Duplessis 2020-01-26 12:09:20 -06:00
parent 858e72e9e9
commit 8b5ca6a0ca

View file

@ -7,14 +7,14 @@ function assetUrl(path: string): string {
self.addEventListener('push', event => { self.addEventListener('push', event => {
const data = event.data!.json(); const data = event.data!.json();
return self.registration.showNotification(data.title, { return event.waitUntil(self.registration.showNotification(data.title, {
badge: assetUrl('logo/lichess-mono-128.png'), badge: assetUrl('logo/lichess-mono-128.png'),
icon: assetUrl('logo/lichess-favicon-192.png'), icon: assetUrl('logo/lichess-favicon-192.png'),
body: data.body, body: data.body,
tag: data.tag, tag: data.tag,
data: data.payload, data: data.payload,
requireInteraction: true, requireInteraction: true,
}); }));
}); });
async function handleNotificationClick(event: NotificationEvent) { async function handleNotificationClick(event: NotificationEvent) {