PageSourceSearch

https://fr.renault.be/renault/one.sw.js

js renault.be collected 2026-09-24 23:07:05 UTC 1,615 bytes, 55 lines download raw bytes

1
2  'use strict';
3
4  let CURRENT_CACHES = {
5    offline: 'offline-v2',
6  };
7  const OFFLINE_URL = '/renault/offline.html';
8
9  function createCacheBustedRequest(url) {
10    let request = new Request(url, { cache: 'reload' });
11    if ('cache' in request) return request;
12    let bustedUrl = new URL(url, self.location.href);
13    const bustedUrlSearch = bustedUrl.search ? (bustedUrl.search + '&') : '?';
14    bustedUrl.search = bustedUrlSearch + 'cachebust=' + Date.now();
15    return new Request(bustedUrl);
16  }
17
18  self.addEventListener('install', event => {
19    self.skipWaiting();
20    event.waitUntil(
21      fetch(createCacheBustedRequest(OFFLINE_URL)).then(function(response) {
22        return caches.open(CURRENT_CACHES.offline).then(function(cache) {
23          return cache.put(OFFLINE_URL, response);
24        });
25      }),
26    );
27  });
28
29  self.addEventListener('activate', event => {
30    let expectedCacheNames = Object.keys(CURRENT_CACHES).map(function(key) {
31      return CURRENT_CACHES[key];
32    });
33
34    event.waitUntil(
35      caches.keys().then(cacheNames => {
36        return Promise.all(
37          cacheNames.map(cacheName => {
38            if (expectedCacheNames.indexOf(cacheName) === -1) {
39              return caches.delete(cacheName);
40            }
41          }),
42        );
43      }),
44    );
45  });
46
47  self.addEventListener('fetch', event => {
48    if (
49      event.request.mode === 'navigate' ||
50      (event.request.method === 'GET' && event.request.headers.get('accept').includes('text/html'))
51    ) {
52      event.respondWith(fetch(event.request).catch(error => caches.match(OFFLINE_URL)));
53    }
54  });
55  

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.