-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsw.js
More file actions
31 lines (29 loc) · 1.03 KB
/
sw.js
File metadata and controls
31 lines (29 loc) · 1.03 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
const CACHE_NAME = 'php-portfolio-v1';
const ASSETS = [
'./',
'./index.html',
'./style.css',
'./script.js',
'./favicon_io/favicon.ico',
'./favicon_io/android-chrome-192x192.png',
'./favicon_io/android-chrome-512x512.png',
'https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap',
'https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-tomorrow.min.css',
'https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/prism.min.js',
'https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-markup-templating.min.js',
'https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-php.min.js'
];
self.addEventListener('install', (event) => {
event.waitUntil(
caches.open(CACHE_NAME).then((cache) => {
return cache.addAll(ASSETS);
})
);
});
self.addEventListener('fetch', (event) => {
event.respondWith(
caches.match(event.request).then((response) => {
return response || fetch(event.request);
})
);
});