add fetch script to same file
This commit is contained in:
parent
9798bf14f4
commit
304bb3a999
2 changed files with 6 additions and 5 deletions
|
@ -1,3 +0,0 @@
|
|||
self.addEventListener('fetch', function(event) {
|
||||
// console.log(`start server worker`); // service worker started
|
||||
});
|
|
@ -1,7 +1,11 @@
|
|||
// register service worker
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.register('./public/pwa/serviceWorker.js').then(function(reg) {
|
||||
// console.log('Successfully registered service worker', reg);
|
||||
navigator.serviceWorker.register('./serviceWorker.js').then(function(reg) {
|
||||
// reg.scope must be '/' to allow '/' as start url
|
||||
}).catch(function(err) {
|
||||
// console.warn('Error whilst registering service worker', err);
|
||||
});
|
||||
}
|
||||
|
||||
// used to fetch the manifest file
|
||||
self.addEventListener('fetch', () => {});
|
||||
|
|
Loading…
Reference in a new issue