var version = 'v34 - 2016-01-20'; var toCache = [ '/', 'index.html', 'activePage.js', 'activePage.js.map', 'config.js', 'config.js.map', 'hesla.js', 'hesla.js.map', 'hesla.webapp', 'favicon.ico', 'icon-128.png', 'icon-30.png', 'icon-60.png', 'index_de.html', 'require.js', 'screen.css' ]; self.addEventListener('install', event => { event.waitUntil( caches.open('static' + version) .then( c => c.addAll(toCache) .then(v => console.log('Yay!'), e => console.log('Error')) ) ); }); self.addEventListener('activate', event => { event.waitUntil(caches.keys().then( keys => Promise.all( keys.filter(key => key != 'static' + version). map(key => caches.delete(key)) ) ) ); }); self.addEventListener('fetch', function(event) { event.respondWith(caches.match(event.request)); });