PageSourceSearch

https://hangler.net/sw.js

js hangler.net collected 2026-10-04 04:32:09 UTC 5,036 bytes, 170 lines download raw bytes

1/**
2 * Welcome to your Workbox-powered service worker!
3 *
4 * You'll need to register this file in your web app and you should
5 * disable HTTP caching for this file too.
6 * See https://goo.gl/nhQhGp
7 *
8 * The rest of the code is auto-generated. Please don't update this file
9 * directly; instead, make changes to your Workbox build configuration
10 * and re-run your build process.
11 * See https://goo.gl/2aRDsh
12 */
13
14importScripts("workbox-v3.6.3/workbox-sw.js");
15workbox.setConfig({modulePathPrefix: "workbox-v3.6.3"});
16
17workbox.core.setCacheNameDetails({prefix: "gatsby-plugin-offline"});
18
19workbox.skipWaiting();
20workbox.clientsClaim();
21
22/**
23 * The workboxSW.precacheAndRoute() method efficiently caches and responds to
24 * requests for URLs in the manifest.
25 * See https://goo.gl/S9QRab
26 */
27self.__precacheManifest = [
28  {
29    "url": "webpack-runtime-7704f4b7fa0b1b223a86.js"
30  },
31  {
32    "url": "styles.5c799dbf959774ff4ae1.css"
33  },
34  {
35    "url": "styles-f43ba98f9f2bf91cef34.js"
36  },
37  {
38    "url": "app-cc92730e08b135ac347b.js"
39  },
40  {
41    "url": "component---node-modules-gatsby-plugin-offline-app-shell-js-0bf711c49d7eb4aee37d.js"
42  },
43  {
44    "url": "offline-plugin-app-shell-fallback/index.html",
45    "revision": "cbd7d511918a28962b7b60560112db12"
46  },
47  {
48    "url": "component---src-pages-404-js-7b244717f810d800bfe4.js"
49  },
50  {
51    "url": "0-b1c4cafbab8202a155b5.js"
52  },
53  {
54    "url": "page-data/404.html/page-data.json",
55    "revision": "36f3bb12b03862bacf3b8d4abb788b92"
56  },
57  {
58    "url": "manifest.webmanifest",
59    "revision": "9657775b68862db0f366cfe11943fa70"
60  }
61].concat(self.__precacheManifest || []);
62workbox.precaching.suppressWarnings();
63workbox.precaching.precacheAndRoute(self.__precacheManifest, {});
64
65workbox.routing.registerRoute(/(\.js$|\.css$|static\/)/, workbox.strategies.cacheFirst(), 'GET');
66workbox.routing.registerRoute(/^https?:.*\page-data\/.*\/page-data\.json/, workbox.strategies.networkFirst(), 'GET');
67workbox.routing.registerRoute(/^https?:.*\.(png|jpg|jpeg|webp|svg|gif|tiff|js|woff|woff2|json|css)$/, workbox.strategies.staleWhileRevalidate(), 'GET');
68workbox.routing.registerRoute(/^https?:\/\/fonts\.googleapis\.com\/css/, workbox.strategies.staleWhileRevalidate(), 'GET');
69
70/* global importScripts, workbox, idbKeyval */
71
72importScripts(`idb-keyval-iife.min.js`)
73const WHITELIST_KEY = `custom-navigation-whitelist`
74
75const navigationRoute = new workbox.routing.NavigationRoute(({ event }) => {
76  const { pathname } = new URL(event.request.url)
77
78  return idbKeyval.get(WHITELIST_KEY).then((customWhitelist = []) => {
79    // Respond with the offline shell if we match the custom whitelist
80    if (customWhitelist.includes(pathname)) {
81      const offlineShell = `/offline-plugin-app-shell-fallback/index.html`
82      const cacheName = workbox.core.cacheNames.precache
83
84      return caches.match(offlineShell, { cacheName }).then(cachedResponse => {
85        if (cachedResponse) return cachedResponse
86
87        console.error(
88          `The offline shell (${offlineShell}) was not found ` +
89            `while attempting to serve a response for ${pathname}`
90        )
91
92        return fetch(offlineShell).then(response => {
93          if (response.ok) {
94            return caches.open(cacheName).then(cache =>
95              // Clone is needed because put() consumes the response body.
96              cache.put(offlineShell, response.clone()).then(() => response)
97            )
98          } else {
99            return fetch(event.request)
100          }
101        })
102      })
103    }
104
105    return fetch(event.request)
106  })
107})
108
109workbox.routing.registerRoute(navigationRoute)
110
111let updatingWhitelist = null
112
113function rawWhitelistPathnames(pathnames) {
114  if (updatingWhitelist !== null) {
115    // Prevent the whitelist from being updated twice at the same time
116    return updatingWhitelist.then(() => rawWhitelistPathnames(pathnames))
117  }
118
119  updatingWhitelist = idbKeyval
120    .get(WHITELIST_KEY)
121    .then((customWhitelist = []) => {
122      pathnames.forEach(pathname => {
123        if (!customWhitelist.includes(pathname)) customWhitelist.push(pathname)
124      })
125
126      return idbKeyval.set(WHITELIST_KEY, customWhitelist)
127    })
128    .then(() => {
129      updatingWhitelist = null
130    })
131
132  return updatingWhitelist
133}
134
135function rawResetWhitelist() {
136  if (updatingWhitelist !== null) {
137    return updatingWhitelist.then(() => rawResetWhitelist())
138  }
139
140  updatingWhitelist = idbKeyval.set(WHITELIST_KEY, []).then(() => {
141    updatingWhitelist = null
142  })
143
144  return updatingWhitelist
145}
146
147const messageApi = {
148  whitelistPathnames(event) {
149    let { pathnames } = event.data
150
151    pathnames = pathnames.map(({ pathname, includesPrefix }) => {
152      if (!includesPrefix) {
153        return `${pathname}`
154      } else {
155        return pathname
156      }
157    })
158
159    event.waitUntil(rawWhitelistPathnames(pathnames))
160  },
161
162  resetWhitelist(event) {
163    event.waitUntil(rawResetWhitelist())
164  },
165}
166
167self.addEventListener(`message`, event => {
168  const { gatsbyApi } = event.data
169  if (gatsbyApi) messageApi[gatsbyApi](event)
170})

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.