Update service-worker.js

This commit is contained in:
FURK4NGG
2025-03-04 01:00:10 +03:00
committed by GitHub
parent 6f8bea4b92
commit 3479bb6717
+7 -2
View File
@@ -1,4 +1,4 @@
const CURRENT_VERSION = 'v70';
const CURRENT_VERSION = 'v72';
const CACHE_NAME = `cache-${CURRENT_VERSION}`;
const urlsToCache = [
@@ -64,10 +64,15 @@ self.addEventListener('activate', event => {
caches.keys().then(cacheNames => {
return Promise.all(
cacheNames.map(cacheName => {
if (cacheName.startsWith('cache-') && cacheName !== CACHE_NAME) {
if (cacheName.startsWith('cache-')) {
const cacheVersion = parseInt(cacheName.replace('cache-', ''), 10);
// Eğer mevcut cache versiyonu, CURRENT_VERSION'dan küçükse, sil
if (cacheVersion < parseInt(CURRENT_VERSION.replace('v', ''), 10)) {
console.log(`Deleting old cache: ${cacheName}`);
return caches.delete(cacheName);
}
}
})
);
}).then(() => {