Permalink
Browse files

fix(workbox): faster service worker register

  • Loading branch information...
pi0 committed Nov 17, 2017
1 parent 7ae84a9 commit 07524a2d4e5605743660b6f0b1e0ceb74aa609ee
Showing with 6 additions and 9 deletions.
  1. +6 −9 packages/workbox/templates/sw.plugin.js
@@ -1,14 +1,11 @@
window.onNuxtReady(() => {
if (!('serviceWorker' in navigator)) {
console.warn('Service workers are not supported.')
return
}
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('<%= options.swURL %>', {
scope: '<%= options.swScope %>'
}).then(function(registration) {
window.$sw = registration
}).catch(function(error) {
console.error('Service worker registration failed:', error);
});
})
console.error('Service worker registration failed:', error)
})
} else {
console.warn('Service workers are not supported.')
}

0 comments on commit 07524a2

Please sign in to comment.