| const CACHE_NAME = 'mindmirror-v2'; | |
| const ASSETS = [ | |
| '/', | |
| '/index.html', | |
| '/style.css', | |
| '/script.js', | |
| '/static/icon-192.png', | |
| '/static/icon-512.png', | |
| 'https://cdn.tailwindcss.com', | |
| 'https://unpkg.com/feather-icons', | |
| 'https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js', | |
| 'https://cdn.jsdelivr.net/npm/axios/dist/axios.min.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)) | |
| ); | |
| }); |