Add files via upload

master
Manas Khurana 2017-08-28 04:27:35 +05:30 committed by GitHub
parent e106110180
commit 875f74b35c
1 changed files with 27 additions and 0 deletions

27
sw.js Normal file
View 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);
})
);
});