-
Notifications
You must be signed in to change notification settings - Fork 1
/
serviceWorker.js
41 lines (37 loc) · 1.05 KB
/
serviceWorker.js
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
let cacheName = "password-manager";
let filesToCache = [
"/quiz/index.html",
// js files
"/quiz/scripts/index.js",
"/quiz/scripts/util.js",
"/quiz/scripts/fadeInfo.js",
"/quiz/scripts/questionScreen.js",
"/quiz/scripts/listScreen.js",
"/quiz/scripts/statisticScreen.js",
"/quiz/scripts/editScreen.js",
"/quiz/scripts/settingsScreen.js",
// css files
"/quiz/styles/index.css",
"/quiz/styles/themes.css",
"/quiz/styles/nav.css",
"/quiz/styles/fadeInfo.css",
"/quiz/styles/questionScreen.css",
"/quiz/styles/listScreen.css",
"/quiz/styles/statisticScreen.css",
"/quiz/styles/editScreen.css",
"/quiz/styles/settingsScreen.css"
];
self.addEventListener("install", (e) => {
e.waitUntil(
caches.open(cacheName).then(function (cache) {
return cache.addAll(filesToCache);
})
);
});
self.addEventListener("fetch", (e) => {
e.respondWith(
caches.match(e.request).then((response) => {
return response || fetch(e.request);
})
);
});