pushh
All checks were successful
/ upload (release) Successful in 31s

This commit is contained in:
pavel 2026-02-12 01:45:26 +01:00
commit e7d1dbe849
5 changed files with 0 additions and 0 deletions

View file

@ -1,51 +0,0 @@
const CACHE_NAME = 'agency-cache-v1';
const ASSETS = [
'/',
'/index.html',
'/src/main.js',
'/src/style.css',
'/manifest.json',
'/icon-192.png',
'/icon-512.png'
];
self.addEventListener('install', (event) => {
event.waitUntil(
caches.open(CACHE_NAME).then((cache) => {
return cache.addAll(ASSETS);
})
);
});
self.addEventListener('fetch', (event) => {
event.respondWith(
caches.match(event.request).then((response) => {
return response || fetch(event.request);
})
);
});
self.addEventListener('push', (event) => {
const data = event.data ? event.data.json() : { title: 'Notification', body: 'New update from Agency' };
const options = {
body: data.body,
icon: '/icon-192.png',
badge: '/icon-192.png',
vibrate: [100, 50, 100],
data: {
dateOfArrival: Date.now(),
primaryKey: '1'
}
};
event.waitUntil(
self.registration.showNotification(data.title, options)
);
});
self.addEventListener('notificationclick', (event) => {
event.notification.close();
event.waitUntil(
clients.openWindow('/')
);
});