PageSourceSearch

https://deskjock.reviews/sw.js

js deskjock.reviews collected 2026-10-07 10:45:42 UTC 1,685 bytes, 79 lines download raw bytes

1//remember to increment the version # when you update the service worker
2const version = "1.00",
3    preCache = "PRECACHE-" + version,
4    cacheList = [ "/" ];
5
6/*
7create a list (array) of urls to pre-cache for your application
8*/
9
10/*  Service Worker Event Handlers */
11
12self.addEventListener( "install", function ( event ) {
13
14    console.log( "Installing the service worker!" );
15
16    self.skipWaiting();
17
18    caches.open( preCache )
19        .then( cache => {
20
21            cache.addAll( cacheList );
22
23        } );
24
25} );
26
27self.addEventListener( "activate", function ( event ) {
28
29    event.waitUntil(
30
31        //wholesale purge of previous version caches
32        caches.keys().then( cacheNames => {
33            cacheNames.forEach( value => {
34
35                if ( value.indexOf( version ) < 0 ) {
36                    caches.delete( value );
37                }
38
39            } );
40
41            console.log( "service worker activated" );
42
43            return;
44
45        } )
46
47    );
48
49} );
50
51self.addEventListener( "fetch", function ( event ) {
52
53    event.respondWith(
54
55        fetch( event.request )
56
57        /* check the cache first, then hit the network */
58        /*
59                caches.match( event.request )
60                .then( function ( response ) {
61
62                    if ( response ) {
63                        return response;
64                    }
65
66                    return fetch( event.request );
67                } )
68        */
69    );
70
71} );
72
73
74/* service worker resources
75
76https: //love2dev.com/blog/what-is-the-service-worker-cache-storage-limit/
77https: //love2dev.com/blog/service-worker-cache/
78
79*/

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.