Update service-worker.js

This commit is contained in:
FURK4NGG
2025-03-04 20:48:36 +03:00
committed by GitHub
parent b023047328
commit 8f5f1104ee
+2 -1
View File
@@ -1,4 +1,4 @@
const CACHE_VERSION = 10; // Versiyon numarası const CACHE_VERSION = 11; // Versiyon numarası
const CACHE_NAME = `my-cache-v${CACHE_VERSION}`; // Cache ismi versiyon numarası ile oluşturuluyor const CACHE_NAME = `my-cache-v${CACHE_VERSION}`; // Cache ismi versiyon numarası ile oluşturuluyor
const URLS_TO_CACHE = [ const URLS_TO_CACHE = [
// Önbelleğe alınacak URL'ler // Önbelleğe alınacak URL'ler
@@ -61,6 +61,7 @@ self.addEventListener('activate', (event) => {
caches.keys().then((cacheNames) => { caches.keys().then((cacheNames) => {
return Promise.all( return Promise.all(
cacheNames.map((cacheName) => { cacheNames.map((cacheName) => {
// Eğer cache ismi mevcut cache ismi değilse, sil
if (cacheName !== CACHE_NAME) { if (cacheName !== CACHE_NAME) {
console.log(`🗑️ Deleting old cache: ${cacheName}`); console.log(`🗑️ Deleting old cache: ${cacheName}`);
return caches.delete(cacheName); return caches.delete(cacheName);