Files
Jorge Luis caudillo esparza 6685ef63fb Initial commit
2026-07-14 11:15:57 -07:00

27 lines
678 B
JavaScript

self.addEventListener('push', function (event) {
const data = event.data ? event.data.json() : {};
const title = data.title || 'Notificación';
const options = {
body: data.body || '',
icon: '/Imagenes/LogoSinFondochico.png',
badge: '/Imagenes/LogoSinFondochico.png',
data: {
url: data.url || '/'
}
};
event.waitUntil(
self.registration.showNotification(title, options)
);
});
self.addEventListener('notificationclick', function (event) {
event.notification.close();
const url = event.notification.data.url || '/';
event.waitUntil(
clients.openWindow(url)
);
});