PageSourceSearch

https://fmintegracao.com.br/app/service-worker.js

js fmintegracao.com.br collected 2026-10-05 22:29:31 UTC 3,418 bytes, 85 lines download raw bytes

1/*
2Copyright 2015, 2019 Google Inc. All Rights Reserved.
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
6 http://www.apache.org/licenses/LICENSE-2.0
7 Unless required by applicable law or agreed to in writing, software
8 distributed under the License is distributed on an "AS IS" BASIS,
9 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 See the License for the specific language governing permissions and
11 limitations under the License.
12*/
13
14// Incrementing OFFLINE_VERSION will kick off the install event and force
15// previously cached resources to be updated from the network.
16const OFFLINE_VERSION = 3;
17const CACHE_NAME = 'offline.V3';
18// Customize this with a different URL if needed.
19const OFFLINE_URL = 'offline.html';
20
21self.addEventListener('install', (event) => {
22  event.waitUntil((async () => {
23    const cache = await caches.open(CACHE_NAME);
24	console.log('👷', 'install', event);
25    // Setting {cache: 'reload'} in the new request will ensure that the response
26    // isn't fulfilled from the HTTP cache; i.e., it will be from the network.
27    await cache.add(new Request(OFFLINE_URL, {cache: 'reload'}));
28  })());
29  self.skipWaiting();
30});
31
32self.addEventListener('activate', (event) => {
33  event.waitUntil((async () => {
34    // Enable navigation preload if it's supported.
35    // See https://developers.google.com/web/updates/2017/02/navigation-preload
36    if ('navigationPreload' in self.registration) {
37      await self.registration.navigationPreload.enable();
38    }
39	console.log('👷', 'activate', event);
40	return self.clients.claim();
41  })());
42
43  // Tell the active service worker to take control of the page immediately.
44  self.clients.claim();
45});
46
47self.addEventListener('fetch', (event) => {
48  // We only want to call event.respondWith() if this is a navigation request
49  // for an HTML page.
50  if (event.request.mode === 'navigate') {
51    event.respondWith((async () => {
52      try {
53        // First, try to use the navigation preload response if it's supported.
54        const preloadResponse = await event.preloadResponse;
55        if (preloadResponse) {
56          return preloadResponse;
57        }
58
59        const networkResponse = await fetch(event.request);
60        return networkResponse;
61      } catch (error) {
62        // catch is only triggered if an exception is thrown, which is likely
63        // due to a network error.
64        // If fetch() returns a valid HTTP response with a response code in
65        // the 4xx or 5xx range, the catch() will NOT be called.
66        console.log('Fetch failed; returning offline page instead.', error);
67
68        const cache = await caches.open(CACHE_NAME);
69        const cachedResponse = await cache.match(OFFLINE_URL);
70        return cachedResponse;
71      }
72    })());
73	//event.respondWith(fetch(event.request));
74  }
75  // If our if() condition is false, then this fetch handler won't intercept the
76  // request. If there are any other fetch handlers registered, they will get a
77  // chance to call event.respondWith(). If no fetch handlers call
78  // event.respondWith(), the request will be handled by the browser as if there
79  // were no service worker involvement.
80});
81/*
82self.addEventListener('appinstalled', (event) => {
83  console.log('👍', 'APP já Instalado nesse Dispositivo!', event);
84});
85*/

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.