Skip to content

Commit

Permalink
fix: catch serviceWorker.ready Promise rejections (#46)
Browse files Browse the repository at this point in the history
closes #45
  • Loading branch information
j0Shi82 committed Dec 10, 2020
1 parent acc68fe commit 563fa94
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ export function register (swUrl, hooks = {}) {
checkValidServiceWorker(swUrl, emit, registrationOptions)
navigator.serviceWorker.ready.then(registration => {
emit('ready', registration)
})
}).catch(error => handleError(emit, error))
} else {
// Is not local host. Just register service worker
registerValidSW(swUrl, emit, registrationOptions)
navigator.serviceWorker.ready.then(registration => {
emit('ready', registration)
})
}).catch(error => handleError(emit, error))
}
})
}
Expand Down Expand Up @@ -124,6 +124,6 @@ export function unregister () {
if ('serviceWorker' in navigator) {
navigator.serviceWorker.ready.then(registration => {
registration.unregister()
})
}).catch(error => handleError(emit, error))
}
}

0 comments on commit 563fa94

Please sign in to comment.