diff mrjunejune/src/public/pwa-register.js @ 273:e02e2036ef84 default tip

add Layer 2 JRPG component system Add reusable content and window modals, an isolated component sandbox, shared cyberpunk scroll areas, production-safe cache freshness, and server-rendered JRPG panel state. Co-authored-by: Copilot <[email protected]>
author MrJuneJune <me@mrjunejune.com>
date Sat, 08 Aug 2026 02:08:08 -0700
parents 60a876c4587a
children
line wrap: on
line diff
--- a/mrjunejune/src/public/pwa-register.js	Fri Aug 07 16:05:29 2026 -0700
+++ b/mrjunejune/src/public/pwa-register.js	Sat Aug 08 02:08:08 2026 -0700
@@ -5,6 +5,7 @@
       .register('/sw.js', { scope: '/' })
       .then((registration) => {
         // console.log('[PWA] Service Worker registered:', registration.scope);
+        void registration.update();
 
         // Check for updates periodically
         setInterval(() => {
@@ -16,11 +17,7 @@
           const newWorker = registration.installing;
           newWorker.addEventListener('statechange', () => {
             if (newWorker.state === 'installed' && navigator.serviceWorker.controller) {
-              // New content available, show update notification
-              if (confirm('New version available! Reload to update?')) {
-                newWorker.postMessage({ type: 'SKIP_WAITING' });
-                window.location.reload();
-              }
+              newWorker.postMessage({ type: 'SKIP_WAITING' });
             }
           });
         });