-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathworker.js
More file actions
116 lines (115 loc) · 4 KB
/
Copy pathworker.js
File metadata and controls
116 lines (115 loc) · 4 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
self.addEventListener("install", (event) => {
event.waitUntil(
caches
.open("v1")
.then((cache) =>
cache.addAll([
"/",
'/about.html',
'/contact.html',
'/skills.html',
'/webfonts/fa-brands-400.ttf',
'/webfonts/fa-brands-400.woff',
'/webfonts/fa-brands-400.woff2',
'/webfonts/fa-solid-900.ttf',
'/webfonts/fa-solid-900.woff',
'/webfonts/fa-solid-900.woff2',
'/webfonts/fa-regular-400.ttf',
'/webfonts/fa-regular-400.woff',
'/webfonts/fa-regular-400.woff2',
'/css/app.css',
'/css/all.min.css',
'/css/Poppins-Regular.ttf',
'/favicon.ico',
'/images/about/about.png',
'/images/about/aboutimg.jpg',
'/images/contact/contact.png',
'/images/contact/contimg.jpg',
'/images/contact/telephone.png',
'/images/contact/left.png',
'/images/contact/right.png',
'/images/contact/mail.png',
'/images/contact/linkedin.png',
'/images/home/home.png',
'/images/home/global.png',
'/images/home/next.png',
'/images/home/fas.jpg',
'/images/home/stick.jpg',
'/images/home/login.jpg',
'/images/home/furniture.jpg',
'/images/home/dave.jpg',
'/images/home/candid.jpg',
'/images/home/bus.jpg',
'/images/skills/angular.png',
'/images/skills/apache.png',
'/images/skills/boot.png',
'/images/skills/cloud.png',
'/images/skills/foundation.png',
'/images/skills/git.png',
'/images/skills/htmlcssjs.png',
'/images/skills/mongo.png',
'/images/skills/mvc.png',
'/images/skills/nginx.png',
'/images/skills/nodejs.png',
'/images/skills/oop.png',
'/images/skills/photoshop.png',
'/images/skills/php.png',
'/images/skills/react.png',
'/images/skills/sass.png',
'/images/skills/silverstripe.png',
'/images/skills/skills.png',
'/images/skills/skillsimg.jpg',
'/images/skills/sql.png',
'/images/skills/ubuntu.png',
'/images/skills/ux.png',
'/images/skills/wordpress.png',
'/images/skills/xml.png',
'/images/skills/xd.png',
'/images/template/div1.png',
'/images/template/global192.png',
'/images/template/handmade-paper.png',
'/images/template/menu.png',
'/images/template/natural-paper.png',
'/images/template/textonly.svg',
'/images/template/wave.svg',
'/images/template/equal.png',
'/js/auto.js',
'/js/circles.js',
'/js/cache.js',
'/js/forms.js',
'/js/overlay.js',
'/js/scripts.js',
'/js/scroll.js',
'/js/sites.js',
'/js/sw.js',
'/js/template.js',
'/js/utilities.js',
'/manifest.json',
'/node_modules/overlayscrollbars/css/OverlayScrollbars.css',
'/node_modules/overlayscrollbars/js/OverlayScrollbars.js',
'/node_modules/vivus/dist/vivus.min.js'
])
)
);
});
self.addEventListener("fetch", (event) => {
// Let the browser do its default thing
// for non-GET requests.
if (event.request.method !== "GET") return;
// Prevent the default, and handle the request ourselves.
event.respondWith(
(async () => {
// Try to get the response from a cache.
const cache = await caches.open("v1");
const cachedResponse = await cache.match(event.request);
if (cachedResponse) {
// If we found a match in the cache, return it, but also
// update the entry in the cache in the background.
if (navigator.onLine) event.waitUntil(cache.add(event.request));
return cachedResponse;
}
// If we didn't find a match in the cache, use the network.
return fetch(event.request);
})()
);
});