parfum/public/service-worker.js
2025-11-15 13:32:38 +07:00

21 lines
510 B
JavaScript

self.addEventListener('push', (event) => {
const notification = event.data.json();
event.waitUntil(
self.registration.showNotification(
notification.title, {
body: notification.body,
icon: 'assets/images/dark-logo.png',
data: {
url: notification.url
}
})
);
})
self.addEventListener('notificationclick', (event) => {
event.waitUntil(
clients.openWindow(event.notification.data.url)
);
})