Dev Tool / Open Source

pwa-kit ⚡

pwa-kit

About The Project

The update mechanism from Plate, generalised: a PWA that updates itself and says so afterwards, rather than asking permission it does not need.

Copy sw.js and pwa-update.js into an app's web root and wire them up. There is no build step, no bundler, and zero dependencies — which is the point: these apps are static directories.

A new service worker installs and activates immediately without waiting for tabs to close. Each open window safely completes current work before reloading seamlessly onto the latest version.

Features

  • ⚡ Immediate Activation: New workers install and take over without stale workers lingering for days across open browser tabs.
  • 🛡️ Unsaved Work Protection (isBusy): The worker asks rather than blindly navigating; pages defer reloads until pending edits or form states are safely resolved.
  • 🌐 Network-First Freshness: Online requests always win to ensure deployed changes take effect on the very next reload, falling back to cache when offline.
  • 🔔 Clean Session Storage Notifications: Avoids polluting URL query strings with update flags, informing users cleanly through in-app toasts.
  • 🚨 Built-in Cache Escape Hatch: Includes an emergency unregister and cache-bust mechanism for wedged clients.

Gallery