From 2ebb68d58e40ba7b195b063aae960e37e16af453 Mon Sep 17 00:00:00 2001 From: kleap-admin Date: Sun, 18 Jan 2026 18:54:20 +0000 Subject: [PATCH] Update public/sw.js --- public/sw.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 public/sw.js diff --git a/public/sw.js b/public/sw.js new file mode 100644 index 0000000..f07b79c --- /dev/null +++ b/public/sw.js @@ -0,0 +1,22 @@ + +// Service Worker for PWA +const CACHE_NAME = 'vibrant-axolotl-glow-v1'; +const urlsToCache = [ + '/', + '/styles/main.css', + '/script/main.js' +]; + +self.addEventListener('install', event => { + event.waitUntil( + caches.open(CACHE_NAME) + .then(cache => cache.addAll(urlsToCache)) + ); +}); + +self.addEventListener('fetch', event => { + event.respondWith( + caches.match(event.request) + .then(response => response || fetch(event.request)) + ); +});