lbry-desktop/web/static/pwa/serviceWorker.js

15 lines
401 B
JavaScript
Raw Permalink Normal View History

2021-06-04 20:58:32 +02:00
// register service worker
if ('serviceWorker' in navigator) {
navigator.serviceWorker
.register('./serviceWorker.js')
2021-06-04 21:22:40 +02:00
.then(function(reg) {
2021-06-04 20:58:32 +02:00
// reg.scope must be '/' to allow '/' as start url
})
2021-06-04 21:22:40 +02:00
.catch(function(err) {
2021-06-04 20:58:32 +02:00
// console.warn('Error whilst registering service worker', err);
});
}
// used to fetch the manifest file
self.addEventListener('fetch', () => {});