var CACHE_NAME = 'ml-03'; var urlsToCache = [ '/css/bootstrap-5.3.0.min.css', '/css/styles.css', '/js/jquery-3.7.0.slim.min.js', '/js/jquery-3.7.0.min.js', '/js/bootstrap-5.3.0.min.js', '/js/react.production.min.js', '/js/react-dom.production.min.js', '/js/prop-types.min.js', '/js/react-beautiful-dnd.min.js', '/js/uuid_v4@latest.js', ]; self.addEventListener('install', function(event) { console.log('[SW] Install'); event.waitUntil( caches.open(CACHE_NAME) .then(function(cache) { console.log('[SW] add to cache'); return cache.addAll(urlsToCache); }) ); }); self.addEventListener('fetch', function (event) { console.log('[SW] Fetch'); event.respondWith( caches.match(event.request).then(function (response) { return response || fetch(event.request); }) ); }); self.addEventListener('message', function (event) { if (event.data.action === 'skipWaiting') { self.skipWaiting(); caches.delete(CACHE_NAME); } });