pwa
This commit is contained in:
parent
f8415c3441
commit
a1dbb328e0
7 changed files with 61 additions and 0 deletions
26
frontend/sw.js
Normal file
26
frontend/sw.js
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
const CACHE_NAME = 'agency-cache-v1';
|
||||
const ASSETS = [
|
||||
'/',
|
||||
'/index.html',
|
||||
'/src/main.js',
|
||||
'/src/style.css',
|
||||
'/manifest.json',
|
||||
'/icon-192.png',
|
||||
'/icon-512.png'
|
||||
];
|
||||
|
||||
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);
|
||||
})
|
||||
);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue