PWA Fundvelo der Caritas.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

service-worker.js 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. // In development, always fetch from the network and do not enable offline support.
  2. // This is because caching would make development more difficult (changes would not
  3. // be reflected on the first load after each change).
  4. const staticCacheName = 'site-static-v1';
  5. const assets = [
  6. '/',
  7. '/index.html',
  8. '/account',
  9. '/account/Found',
  10. '/account/Missing',
  11. '/info',
  12. '/caritas_services',
  13. '/lost_found',
  14. '/keydata',
  15. '/keydata/Found',
  16. '/keydata/Missing',
  17. '/conclusion_found',
  18. '/conclusion_missing',
  19. '/doneimage',
  20. 'css/app.css',
  21. '_content/BlazorColorPicker/colorpicker.css',
  22. '_content/MatBlazor/dist/matBlazor.css',
  23. 'css/united/bootstrap.min.css',
  24. 'css/united/_bootswatch.min.css',
  25. 'css/united/_variables.min.css',
  26. '_content/BlazorAnimate/blazorAnimateInterop.js',
  27. '_content/MatBlazor/dist/matBlazor.js',
  28. '_content/BlazorColorPicker/colorpicker.js',
  29. 'images/batch_found.png',
  30. 'images/batch_fundvelo.png',
  31. 'images/batch_kulturlegi.png',
  32. 'images/batch_markt.png',
  33. 'images/batch_missing.png',
  34. 'images/caritas_logo.png',
  35. 'images/integrate_logo.png',
  36. 'images/done.png',
  37. 'images/icon_camera.png',
  38. 'images/icon_driveupload.png',
  39. 'images/icon_location.png'
  40. ];
  41. // install event
  42. self.addEventListener('install', evt => {
  43. evt.waitUntil(
  44. caches.open(staticCacheName).then(cache => {
  45. console.log('caching app assets');
  46. cache.addAll(assets);
  47. })
  48. );
  49. });
  50. // activate event
  51. self.addEventListener('activate', evt => {
  52. //console.log("Service-Worker has been activated.");
  53. evt.waitUntil(
  54. caches.keys().then(keys => {
  55. return Promise.all(keys
  56. .filter(key => key !== staticCacheName)
  57. .map(key => caches.delete())
  58. )
  59. })
  60. );
  61. });
  62. self.addEventListener('fetch', evt => {
  63. evt.respondWith(
  64. caches.match(evt.request).then(cacheRes => {
  65. return cacheRes || fetch(evt.request);
  66. })
  67. );
  68. });