const CACHE_NAME = 'persian-optimizer-v2'; const ASSETS = [ '/', '/index.html', '/style.css', '/script.js', '/components/navbar.js', '/components/footer.js', 'https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js', 'https://unpkg.com/feather-icons', 'https://cdn.tailwindcss.com', 'https://unpkg.com/detect-browser', 'https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.1/anime.min.js', 'https://unpkg.com/aos@2.3.1/dist/aos.js' ]; self.addEventListener('install', (event) => { event.waitUntil( caches.open(CACHE_NAME) .then((cache) => cache.addAll(ASSETS)) ); }); self.addEventListener('fetch', (event) => { event.respondWith( caches.match(event.request) .then((response) => response || fetch(event.request)) ); });