- aggiornamenti guida RIS, FAQ
- Editor HTML aggiunto CSS e Script - Statistiche - CRISBalanceBar - Inizio Sync... (ma disattivato)
This commit is contained in:
@@ -117,8 +117,62 @@ self.addEventListener('activate', (event) => {
|
||||
);
|
||||
})
|
||||
);
|
||||
self.clients.claim(); // SERVE? OPPURE NO ?
|
||||
});
|
||||
|
||||
const USASYNC = false;
|
||||
// PER ATTIVARE IL SYNC TOGLI L'AREA COMMENTATA DI 'FETCH' QUI SOTTO ....
|
||||
/*
|
||||
// Strategia fetch
|
||||
self.addEventListener('fetch', (event) => {
|
||||
const { request } = event;
|
||||
const url = new URL(request.url);
|
||||
|
||||
// ============================================
|
||||
// IMPORTANTE: NON cachare API /sync o /loadsite
|
||||
// ============================================
|
||||
if (url.pathname.includes('/api/') ||
|
||||
url.pathname.includes('/sync') ||
|
||||
url.pathname.includes('/loadsite')) {
|
||||
// Lascia passare normalmente - IndexedDB gestisce cache
|
||||
return;
|
||||
}
|
||||
|
||||
// ============================================
|
||||
// Cache Strategy per assets statici
|
||||
// ============================================
|
||||
if (request.method === 'GET') {
|
||||
event.respondWith(
|
||||
caches.match(request).then((cachedResponse) => {
|
||||
if (cachedResponse) {
|
||||
return cachedResponse;
|
||||
}
|
||||
|
||||
return fetch(request).then((response) => {
|
||||
// Non cachare se non è successo
|
||||
if (!response || response.status !== 200 || response.type !== 'basic') {
|
||||
return response;
|
||||
}
|
||||
|
||||
// Clona e salva in cache
|
||||
const responseToCache = response.clone();
|
||||
caches.open(CACHE_NAME).then((cache) => {
|
||||
cache.put(request, responseToCache);
|
||||
});
|
||||
|
||||
return response;
|
||||
}).catch(() => {
|
||||
// Offline fallback
|
||||
if (request.destination === 'document') {
|
||||
return caches.match('/offline.html');
|
||||
}
|
||||
});
|
||||
})
|
||||
);
|
||||
}
|
||||
});
|
||||
*/
|
||||
|
||||
console.log(
|
||||
' [ VER-' +
|
||||
VITE_APP_VERSION +
|
||||
|
||||
Reference in New Issue
Block a user