Add files via upload
This commit is contained in:
parent
e106110180
commit
875f74b35c
27
sw.js
Normal file
27
sw.js
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
var CACHE_NAME = 'youcount-cache-1.0';
|
||||||
|
var urlsToCache = [
|
||||||
|
'/index.html',
|
||||||
|
'/images/social.png',
|
||||||
|
'/js/script.js'
|
||||||
|
];
|
||||||
|
self.addEventListener('install', function (event) {
|
||||||
|
event.waitUntil(
|
||||||
|
caches.open(CACHE_NAME)
|
||||||
|
.then(function (cache) {
|
||||||
|
console.log('Opened cache');
|
||||||
|
return cache.addAll(urlsToCache);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
self.addEventListener('fetch', function (event) {
|
||||||
|
event.respondWith(
|
||||||
|
caches.match(event.request)
|
||||||
|
.then(function (response) {
|
||||||
|
if (response) {
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
return fetch(event.request);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user