This repository has been archived by the owner on Nov 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
sw.js
56 lines (54 loc) · 1.48 KB
/
sw.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
42
43
44
45
46
47
48
49
50
51
52
53
54
var cacheName = 'GCPCrashCourse';
var filesToCache = [
'/',
'/index.html',
'/team.html',
'css/index.css',
'css/team.css/',
'/team.js',
'js/index.js',
'after-landing.svg',
'images/Behance.svg',
'images/dsc-logo-long.svg',
'images/dsc-logo-square.svg',
'images/Facebook.svg',
'images/Github.svg',
'images/Instagram.svg',
'images/landing.svg',
'images/Linkedin.svg',
'images/Medium.svg',
'images/menu-close.svg',
'images/menu-image.svg',
'images/Twitter.svg',
'images/Youtube.svg',
'images/team.svg',
'images/board19/samarth.jpg',
'images/board19/ayush.jpg',
'images/board19/samyak.jpg',
'images/board19/aritro.jpg',
'images/board19/dhiraj.jpg',
'images/board19/jayakrishna.jpg',
'images/board19/abhishek.jpg',
'images/board19/raina.jpg',
'images/board19/apurva.jpg',
'images/board19/preethi.jpg',
'images/board19/amurt.jpg',
'icons/favicons/icon-512x512.png',
'icons/favicons/favicon.ico'
];self.addEventListener('install', function(e) {
console.log('[ServiceWorker] Install');
e.waitUntil(
caches.open(cacheName).then(function(cache) {
console.log('[ServiceWorker] Caching app shell');
return cache.addAll(filesToCache);
})
);
});self.addEventListener('activate', event => {
event.waitUntil(self.clients.claim());
});self.addEventListener('fetch', event => {
event.respondWith(
caches.match(event.request, {ignoreSearch:true}).then(response => {
return response || fetch(event.request);
})
);
});