const cacheName = 'gottesdienste-v1.2';
const assets = [
  '/',
  '/static/app.css',
  '/static/app.js',
  '/static/gallery.css',
  '/static/gallery.js',
  '/static/audioplayer.css',
  '/static/audioplayer.js',
  '/static/icons/logo-192x192.png',
  '/static/icons/logo-512x512.png',
  '/static/logo.png',
  '/static/logoW.png'
];

self.addEventListener('install', e => {
  e.waitUntil(
    caches.open(cacheName).then(cache => {
      return cache.addAll(assets);
    })
  );
});

self.addEventListener('fetch', e => {
  e.respondWith(
    caches.match(e.request).then(response => {
      return response || fetch(e.request);
    })
  );
});