Spaces:
Running
Running
Create sw.js
Browse files- src/static/sw.js +20 -0
src/static/sw.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const CACHE_NAME = 'quantvat-v1';
|
| 2 |
+
const ASSETS = [
|
| 3 |
+
'/',
|
| 4 |
+
'/static/css/base.css',
|
| 5 |
+
'https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;800&display=swap'
|
| 6 |
+
];
|
| 7 |
+
|
| 8 |
+
self.addEventListener('install', (event) => {
|
| 9 |
+
event.waitUntil(
|
| 10 |
+
caches.open(CACHE_NAME).then((cache) => cache.addAll(ASSETS))
|
| 11 |
+
);
|
| 12 |
+
});
|
| 13 |
+
|
| 14 |
+
self.addEventListener('fetch', (event) => {
|
| 15 |
+
event.respondWith(
|
| 16 |
+
caches.match(event.request).then((response) => {
|
| 17 |
+
return response || fetch(event.request);
|
| 18 |
+
})
|
| 19 |
+
);
|
| 20 |
+
});
|