feat: inicializacion de RecreoPay - Monedero QR y Pre-ordenes para Soda Escolar CR

This commit is contained in:
unknown
2026-10-04 14:54:49 -06:00
commit 691b6f79a2
15 changed files with 4623 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
const CACHE_NAME = 'recreopay-static-v1';
const ASSETS_TO_CACHE = [
'/',
'/index.html',
'/pos.html',
'/carnet.html',
'/css/styles.css',
'/js/sounds.js',
'/manifest.json'
];
self.addEventListener('install', (event) => {
event.waitUntil(
caches.open(CACHE_NAME).then((cache) => {
return cache.addAll(ASSETS_TO_CACHE).catch(err => console.log('Cache warn:', err));
})
);
self.skipWaiting();
});
self.addEventListener('activate', (event) => {
event.waitUntil(
caches.keys().then((keys) => {
return Promise.all(
keys.filter((key) => key !== CACHE_NAME).map((key) => caches.delete(key))
);
})
);
self.clients.claim();
});
self.addEventListener('fetch', (event) => {
// Let API requests pass through to the network
if (event.request.url.includes('/api/')) {
return;
}
event.respondWith(
caches.match(event.request).then((cachedResponse) => {
return cachedResponse || fetch(event.request).catch(() => {
if (event.request.mode === 'navigate') {
return caches.match('/index.html');
}
});
})
);
});