Update sw.js
Browse files
sw.js
CHANGED
@@ -47,3 +47,25 @@ self.addEventListener('fetch', (event) => {
|
|
47 |
})
|
48 |
);
|
49 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
})
|
48 |
);
|
49 |
});
|
50 |
+
self.addEventListener('fetch', (event) => {
|
51 |
+
console.log('[SW] fetch:', event.request.url);
|
52 |
+
event.respondWith(
|
53 |
+
caches.match(event.request, { ignoreSearch: true })
|
54 |
+
.then(response => {
|
55 |
+
if (response) {
|
56 |
+
console.log('[SW] γγ£γγ·γ₯γγγ:', event.request.url);
|
57 |
+
return response;
|
58 |
+
}
|
59 |
+
console.log('[SW] γγγγ―γΌγ―εεΎ:', event.request.url);
|
60 |
+
return fetch(event.request);
|
61 |
+
})
|
62 |
+
.catch(err => {
|
63 |
+
console.error('[SW] γγ§γγγ¨γ©γΌ:', event.request.url, err);
|
64 |
+
return new Response('γͺγγ©γ€γ³γ§γ’γ―γ»γΉγ§γγΎγγ', {
|
65 |
+
status: 503,
|
66 |
+
statusText: 'Offline',
|
67 |
+
});
|
68 |
+
})
|
69 |
+
);
|
70 |
+
});
|
71 |
+
|