aboutsummaryrefslogtreecommitdiffhomepage
path: root/worker.js
blob: 029578a40e743274bdc4995479d4fefc6746a14e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
self.addEventListener('install', event => {
    event.waitUntil(
        caches
            .open('homer')
            .then(cache =>
                cache.addAll([
                    '.',
                    'index.html',
                    'config.yml',
                    'app.css',
                    'app.js',
                    'vendors/vue.min.js',
                    'vendors/js-yaml.min.js',
                    'vendors/font-awesone.min.css',
                    'vendors/bulma.min.css',
                    'assets/logo.png',
                    'assets/favicon.png',
                    'webfonts/raleway/raleway-v14-latin-regular.woff',
                    'webfonts/raleway/raleway-v14-latin-regular.woff2',
                    'webfonts/lato/lato-v16-latin-regular.woff',
                    'webfonts/lato/lato-v16-latin-regular.woff2',
                    'webfonts/fa-brands-400.woff',
                    'webfonts/fa-brands-400.woff2',
                    'webfonts/fa-brands-400.svg',
                    'webfonts/fa-brands-400.ttf',
                    'webfonts/fa-brands-400.eot',
                    'webfonts/fa-regular-400.woff',
                    'webfonts/fa-regular-400.woff2',
                    'webfonts/fa-regular-400.svg',
                    'webfonts/fa-regular-400.ttf',
                    'webfonts/fa-regular-400.eot',
                    'webfonts/fa-solid-900.woff',
                    'webfonts/fa-solid-900.woff2',
                    'webfonts/fa-solid-900.svg',
                    'webfonts/fa-solid-900.ttf',
                    'webfonts/fa-solid-900.eot',
                ])
            )
    )
})

self.addEventListener('fetch', event => {
    event.respondWith(
        caches.match(event.request).then(response => {
            if (response) {
                return response;
            }
            return fetch(event.request);
        })
    );
});