splitting shell from data

This commit is contained in:
TLRZ Seyfferth 2018-01-24 17:43:37 +01:00
parent d6031b4e59
commit d44d5bdae3
2 changed files with 17 additions and 7 deletions

View File

@ -1,7 +1,7 @@
{ {
"manifest_version": 1, "manifest_version": 1,
"name": "chrosey.de Inventur", "name": "chrosey.de Inventur",
"version": "1.1", "version": "1.2",
"default_locale": "de", "default_locale": "de",
"description": "Inventur-Helfer", "description": "Inventur-Helfer",
@ -19,7 +19,7 @@
"type": "image/png" "type": "image/png"
} }
], ],
"theme_color": "#303F9F", "theme_color": "#009688",
"background_color": "#C5CAE9", "background_color": "#004d40",
"display": "standalone" "display": "standalone"
} }

View File

@ -1,7 +1,7 @@
var APP_SHELL_VERSION = 2; var APP_SHELL_VERSION = 2;
var APP_SHELL_CACHE = `inventur_shell-v${APP_SHELL_VERSION}`; var APP_SHELL_CACHE = `inventur_shell-v${APP_SHELL_VERSION}`;
var urlsToCache = [ var APP_SHELL_URLS = [
'./', './',
'css/lib/materialize.min.css', 'css/lib/materialize.min.css',
'js/lib/materialize.min.js', 'js/lib/materialize.min.js',
@ -10,8 +10,12 @@ var urlsToCache = [
'js/lib/jquery.min.js', 'js/lib/jquery.min.js',
'js/lib/vue-dev.js', 'js/lib/vue-dev.js',
'js/lib/vue.min.js', 'js/lib/vue.min.js',
'js/lib/vue-resource.min.js', 'js/lib/vue-resource.min.js'
'data/articles.json' ];
var APP_DATA_VERSION = 1;
var APP_DATA_CACHE = `inventur_data-v${APP_DATA_VERSION}`;
var APP_DATA_URLS = [
'data/articles.json',
]; ];
self.addEventListener('install', function(event){ self.addEventListener('install', function(event){
@ -19,7 +23,13 @@ self.addEventListener('install', function(event){
caches.open(APP_SHELL_CACHE) caches.open(APP_SHELL_CACHE)
.then(function(cache){ .then(function(cache){
console.log("[Cache] opened: ", APP_SHELL_CACHE); console.log("[Cache] opened: ", APP_SHELL_CACHE);
return cache.addAll(urlsToCache); return cache.addAll(APP_SHELL_URLS);
})
).waitUntil(
caches.open(APP_DATA_CACHE)
.then(function(cache){
console.log("[Cache] opened: ", APP_DATA_CACHE);
return cache.addAll(APP_DATA_URLS);
}) })
); );
}); });