PozoAppNov266pm/public/sw.js

21 lines
443 B
JavaScript
Raw Permalink Normal View History

const CACHE_NAME = 'pozoapp-v1';
const urlsToCache = [
'/',
'/static/css/main.css',
'/static/js/main.js',
'/og/home.jpg'
];
self.addEventListener('install', event => {
event.waitUntil(
caches.open(CACHE_NAME)
.then(cache => cache.addAll(urlsToCache))
);
});
self.addEventListener('fetch', event => {
event.respondWith(
caches.match(event.request)
.then(response => response || fetch(event.request))
);
});