-
Notifications
You must be signed in to change notification settings - Fork 4
/
serviceworker.njk
83 lines (77 loc) · 2.1 KB
/
serviceworker.njk
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
---
permalink: serviceworker.js
---
var CACHE_NAME = "nejsconf-2018-{{ pkg.serviceworkerversion }}";
var urlsToCache = [
"/",
"https://use.typekit.net/ppn2vqj.css",
"/code-of-conduct/",
// "/speakers/",
// "/venue/",
// "/dates/",
// Sponsors
"/assets/img/sponsors/zillow.svg" ,
"/assets/img/sponsors/agape-red.svg",
"/assets/img/sponsors/sitepen.svg" ,
"/assets/img/sponsors/flywheel.svg" ,
"/assets/img/sponsors/flyover-technical.svg",
"/assets/img/sponsors/midland-code.svg",
// Images
"/assets/img/space-bg.png",
"/assets/img/earth-nobg-crop.webp",
// maybe unnecessary?
"/assets/img/earth-nobg-crop.png",
"/assets/img/moon.svg",
"/assets/img/telescope.svg",
"/assets/img/facebook.svg",
"/assets/img/facebook-active.svg",
"/assets/img/twitter.svg",
"/assets/img/twitter-active.svg",
"/assets/img/infoblock-astronaut-thumb.png",
"/assets/img/infoblock-moon-thumb.png",
"/assets/img/infoblock-astronaut.png",
"/assets/img/infoblock-moon.png",
"/assets/img/lander-stars.svg",
"/assets/img/landed.jpg",
"/assets/img/lander.svg"
// speakers
// "/speakers/clarissa/",
// "/speakers/seldo/",
// "/speakers/carmalou/",
// "/speakers/chantastic/",
// "/speakers/haubertdashery/",
// "/speakers/karlgroves/",
// "/speakers/benmvp/",
// "/speakers/stevekinney/",
// "/speakers/sitnikcode/",
// "/assets/img/speakers/clarissa.jpg",
// "/assets/img/speakers/seldo.jpg",
// "/assets/img/speakers/carmalou.jpg",
// "/assets/img/speakers/chantastic.jpg",
// "/assets/img/speakers/haubertdashery.jpg",
// "/assets/img/speakers/karlgroves.jpg",
// "/assets/img/speakers/benmvp.jpg",
// "/assets/img/speakers/stevekinney.jpg",
// "/assets/img/speakers/sitnikcode.jpg",
];
self.addEventListener("install", function(event) {
event.waitUntil(
caches.open(CACHE_NAME)
.then(function(cache) {
return cache.addAll(urlsToCache);
})
);
});
self.addEventListener("fetch", function(event) {
event.respondWith(
caches.match(event.request)
.then(function(response) {
// Cache hit - return response
if (response) {
return response;
}
return fetch(event.request);
}
)
);
});