bit Bswup

Preparing the app for offline use, please wait...

0%

bit platform logo Bswup
NuGet GitHub

Backing Out of Bswup

Fully remove Bswup from a deployed app - dropping offline support, or recovering clients stuck on a broken worker or cache - with the self-destructing cleanup worker.

Replace the content of your service-worker.js and service-worker.published.js (the file deployed builds actually ship, via the ServiceWorker item's PublishedContent mapping) with:

javascript
self.importScripts('_content/Bit.Bswup/bit-bswup.sw-cleanup.js');

What happens next

On its next update check, every client installs this self-destructing worker instead. It:

  1. activates immediately,
  2. purges this app's Bswup and Blazor caches,
  3. unregisters its own registration, and
  4. signals open tabs to detach.

Tabs the previous worker controlled reload once; everything afterwards runs purely from the network, even while the page keeps referencing bit-bswup.js - each later load just repeats the register/self-unregister cycle silently, with no reloads.

When can the script tag go?
Once no client has loaded the old app for as long as your cache headers require, the bit-bswup.js script tag can be removed from the host document too.

Client-side reset without backing out

If you only need to recover a single broken client (not remove Bswup from the deployment), prefer BitBswup.forceRefresh() - it clears this app's caches, unregisters its worker, and reloads, without touching the deployed service worker file.