38 lines
1.0 KiB
JavaScript
38 lines
1.0 KiB
JavaScript
var APP_SHELL_CACHE = "inventur_shell-v2";
|
|
var urlsToCache = [
|
|
'.',
|
|
'css/lib/materialize.min.css',
|
|
'js/lib/materialize.min.js',
|
|
'js/lib/accounting.min.js',
|
|
'js/lib/moment-with-locales.min.js',
|
|
'js/lib/jquery.min.js',
|
|
'js/lib/vue-dev.js',
|
|
'js/lib/vue.min.js',
|
|
'js/lib/vue-resource.min.js',
|
|
'fonts/Roboto/*',
|
|
//'js/model/inventory_article.js'
|
|
];
|
|
|
|
self.addEventListener('install', function(event){
|
|
event.waitUntil(
|
|
caches.open(APP_SHELL_CACHE)
|
|
.then(function(cache){
|
|
console.log("[Cache] opened: ", APP_SHELL_CACHE);
|
|
return cache.addAll(urlsToCache);
|
|
})
|
|
);
|
|
});
|
|
|
|
self.addEventListener('fetch', function(event){
|
|
event.respondWith(
|
|
caches.open(APP_SHELL_CACHE).then(function(cache) {
|
|
return fetch(event.request)
|
|
.then(function(response){
|
|
cache.put(event.request, response.clone());
|
|
return response;
|
|
});
|
|
})
|
|
);
|
|
});
|
|
|