PageSourceSearch

https://www.padelio.org/sw.js

js padelio.org collected 2026-10-04 08:03:16 UTC 2,072 bytes, 68 lines download raw bytes

1// Service worker that clears all caches and unregisters itself
2// This is designed to clean up any cached content from previous versions
3
4self.addEventListener("install", (event) => {
5  console.log("[SW] Installing cache-clearing service worker");
6
7  event.waitUntil(
8    // Delete all caches
9    caches
10      .keys()
11      .then((cacheNames) => {
12        console.log("[SW] Found caches:", cacheNames);
13        return Promise.all(
14          cacheNames.map((cacheName) => {
15            console.log("[SW] Deleting cache:", cacheName);
16            return caches.delete(cacheName);
17          }),
18        );
19      })
20      .then(() => {
21        console.log("[SW] All caches cleared");
22        // Force the service worker to activate immediately
23        return self.skipWaiting();
24      }),
25  );
26});
27
28self.addEventListener("activate", (event) => {
29  console.log("[SW] Activating cache-clearing service worker");
30
31  event.waitUntil(
32    // Delete all caches again during activation to be thorough
33    caches
34      .keys()
35      .then((cacheNames) => {
36        return Promise.all(
37          cacheNames.map((cacheName) => {
38            console.log("[SW] Deleting cache during activation:", cacheName);
39            return caches.delete(cacheName);
40          }),
41        );
42      })
43      .then(() => {
44        console.log("[SW] All caches cleared during activation");
45        // Take control of all clients immediately
46        return self.clients.claim();
47      })
48      .then(() => {
49        // Notify all clients that caches have been cleared
50        return self.clients.matchAll().then((clients) => {
51          clients.forEach((client) => {
52            client.postMessage({
53              type: "CACHE_CLEARED",
54              message: "All caches have been cleared",
55            });
56          });
57        });
58      }),
59  );
60});
61
62// Don't cache anything - let everything go to the network
63self.addEventListener("fetch", (event) => {
64  // Pass through to network, no caching
65  event.respondWith(fetch(event.request));
66});
67
68console.log("[SW] Cache-clearing service worker loaded");

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.