hubl/src/sw.js

66 lines
2.2 KiB
JavaScript

self.addEventListener('install', function (e) {
e.waitUntil(
caches.open('hubl-store').then(function (cache) {
return cache.addAll([
'/components/hubl-reactivity.js',
'/components/hubl-search-users.js',
'/components/hubl-status.js',
'/fonts/custom-icons.eot',
'/fonts/custom-icons.svg',
'/fonts/custom-icons.ttf',
'/fonts/custom-icons.woff',
'/fonts/FacitBold.eot',
'/fonts/FacitBold.svg',
'/fonts/FacitBold.ttf',
'/fonts/FacitBold.woff',
'/fonts/FacitRegular.eot',
'/fonts/FacitRegular.svg',
'/fonts/FacitRegular.ttf',
'/fonts/FacitRegular.woff',
'/fonts/material-design-icons.eot',
'/fonts/material-design-icons.svg',
'/fonts/material-design-icons.ttf',
'/fonts/material-design-icons.woff',
'/fonts/material-design-icons.woff2',
'/fonts/RefrigeratorDelxW01Bold.eot',
'/fonts/RefrigeratorDelxW01Bold.svg',
'/fonts/RefrigeratorDelxW01Bold.ttf',
'/fonts/RefrigeratorDelxW01Bold.woff',
'/fonts/simple-line-icons.eot',
'/fonts/simple-line-icons.svg',
'/fonts/simple-line-icons.ttf',
'/fonts/simple-line-icons.woff',
'/fonts/simple-line-icons.woff2',
'/images/add-user.svg',
'/images/alien.svg',
'/images/arrow-down.svg',
'/images/calendar.svg',
'/images/chevron-down.png',
'/images/favicon.png',
'/images/hubl-icon-192.png',
'/images/hubl-icon-512.png',
'/images/logo.png',
'/scripts/index.js',
'/syles/index.css',
'/index.html',
'/'
]);
})
);
});
//TODO: Can't use fetch because of unpkg, e.request is missing a part of the package name "@startinblox/core" become "@startinblox"
// self.addEventListener('fetch', function (e) {
// Handle direct loading /xyz/ when server is unjoinable
// if (e.request.mode === 'navigate') {
// e.respondWith(caches.match('/'));
// return;
// }
// e.respondWith(
// fetch(e.request, {
// credentials: 'include'
// }).catch(function() {
// return caches.match(e.request);
// })
// );
// });