PageSourceSearch

https://aidealer360.com/service-worker.js

js aidealer360.com collected 2026-09-24 12:38:15 UTC 1,601 bytes, 46 lines download raw bytes

1// AI DEALER360 - Kill-switch service worker.
2// Previous versions of this file aggressively cached HTML/assets and caused
3// stale preview/production loads after deploys. This replacement worker:
4//   1. Activates immediately
5//   2. Deletes every cache this origin owns for this SW
6//   3. Unregisters itself
7//   4. Reloads any controlled window clients so they pick up fresh HTML
8//
9// Keep this file at /service-worker.js for at least one release cycle so
10// returning browsers evict the old registration.
11
12self.addEventListener('install', () => {
13  self.skipWaiting();
14});
15
16self.addEventListener('activate', (event) => {
17  event.waitUntil((async () => {
18    try {
19      const names = await caches.keys();
20      await Promise.allSettled(
21        names
22          .filter((n) =>
23            n.startsWith('ai-dealer360-') ||
24            n.startsWith('dynamic-cache') ||
25            n.startsWith('workbox-') ||
26            n.includes('precache') ||
27            n.includes('runtime') ||
28            n.includes('supabase-api-cache')
29          )
30          .map((n) => caches.delete(n))
31      );
32      await self.clients.claim();
33      // NOTE: Do NOT call client.navigate(client.url) here. Forcing a reload
34      // on activate kicked users out mid-action (typing a reply, editing a
35      // note, etc.). Unregistering is enough — the next page load will run
36      // without a SW.
37    } finally {
38      await self.registration.unregister();
39    }
40  })());
41});
42
43
44// No fetch handler — Chrome warns that no-op fetch handlers add per-navigation
45// overhead, and we don't actually intercept anything.
46

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.