Skip to content

Commit

Permalink
fix: check if hooks are provided (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
sqal authored and yyx990803 committed Feb 12, 2018
1 parent e12aa44 commit 55276a5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const isLocalhost = Boolean(

export function register (swUrl, hooks) {
const emit = (hook, ...args) => {
if (hooks[hook]) {
if (hooks && hooks[hook]) {
hooks[hook](...args)
}
}
Expand Down

0 comments on commit 55276a5

Please sign in to comment.