-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathservice-worker.js
More file actions
66 lines (65 loc) · 1.92 KB
/
Copy pathservice-worker.js
File metadata and controls
66 lines (65 loc) · 1.92 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
// const CACHE_NAME = "aurelienbottazini.com-v6";
// self.addEventListener("install", function (event) {
// function addDefaultUrlsToCache() {
// const urlsToCache = [
// "/offline.html",
// "/notes.html",
// "/about.html",
// "/resume.html",
// "https://fonts.googleapis.com/css?family=Alegreya:400,400i|Passion+One|Permanent+Marker",
// ];
// return caches.open(CACHE_NAME).then(function (cache) {
// console.info("Precaching:");
// console.table(urlsToCache);
// return cache.addAll(urlsToCache);
// });
// }
//
// event.waitUntil(addDefaultUrlsToCache());
// });
//
// self.addEventListener("activate", function (event) {
// function deleteOldCaches() {
// return caches.keys().then(function (cacheNames) {
// return Promise.all(
// cacheNames.map(function (cacheName) {
// if (
// CACHE_NAME !== cacheName &&
// cacheName.startsWith("aurelienbottazini.com-")
// ) {
// return caches.delete(cacheName);
// }
// }),
// );
// });
// }
// event.waitUntil(deleteOldCaches());
// });
//
// self.addEventListener("fetch", function (event) {
// function isHtmlRequest(event) {
// return event.request.url.endsWith(".html");
// }
// function saveInCache(response) {
// if (response.url.startWith("chrome-extension://")) {
// return;
// }
// if (response.url.includes("/fgw")) {
// return;
// }
// caches.open(CACHE_NAME).then((cache) => cache.add(response.url));
// }
//
// event.respondWith(
// fetch(event.request)
// .then(function (response) {
// saveInCache(response);
// return response;
// })
// .catch((_fetch_error) => {
// return caches.match(event.request).then(function (response) {
// return response || caches.match("/offline.html");
// });
// }),
// );
// });