PageSourceSearch

https://www.deco.fr/service-worker.js

js deco.fr collected 2026-10-02 06:19:16 UTC 1,722 bytes, 58 lines download raw bytes

1const CACHE_NAME = 'offline';
2const OFFLINE_URL = 'offline.html';
3
4// Web push
5function setupSharedBatchSDK() {
6    const BATCHSDK_MAJOR_VERSION = 4;
7
8    importScripts("https://via.batch.com/v" + BATCHSDK_MAJOR_VERSION + "/worker.min.js");
9
10    const eventsList = ["pushsubscriptionchange", "push", "notificationclick", "message", "install"];
11    eventsList.forEach(eventName => {
12        self.addEventListener(eventName, event => {
13            event.waitUntil(self.handleBatchSDKEvent(eventName, event));
14        });
15    });
16}
17
18setupSharedBatchSDK();
19
20self.addEventListener('install', (event) => {
21    event.waitUntil((async () => {
22        const cache = await caches.open(CACHE_NAME);
23        await cache.add(new Request(OFFLINE_URL, {cache: 'reload'}));
24    })());
25
26    self.skipWaiting();
27});
28
29self.addEventListener('activate', (event) => {
30    event.waitUntil((async () => {
31        if ('navigationPreload' in self.registration) {
32            await self.registration.navigationPreload.enable();
33        }
34    })());
35
36    self.clients.claim();
37});
38
39self.addEventListener('fetch', (event) => {
40    if (event.request.mode === 'navigate') {
41        event.respondWith((async () => {
42            try {
43                const preloadResponse = await event.preloadResponse;
44                if (preloadResponse) {
45                    return preloadResponse;
46                }
47
48                const networkResponse = await fetch(event.request);
49                return networkResponse;
50            } catch (error) {
51                const cache = await caches.open(CACHE_NAME);
52                const cachedResponse = await cache.match(OFFLINE_URL);
53
54                return cachedResponse;
55            }
56        })());
57    }
58});

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.