Skip to content

Commit

Permalink
fix: don't invoke callback if not present in start
Browse files Browse the repository at this point in the history
  • Loading branch information
troch committed Jul 23, 2015
1 parent 49cf678 commit 3ecc838
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions modules/Router5.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export default class Router5 {

let cb = (err) => {
window.addEventListener('popstate', this.onPopState.bind(this))
done(err)
if (done) done(err)
}

let navigateToDefault = () => this.navigate(opts.defaultRoute, opts.defaultParams, {replace: true}, cb)
Expand All @@ -114,7 +114,11 @@ export default class Router5 {
else if (opts.defaultRoute) navigateToDefault()
else cb(err)
})
} else if (opts.defaultRoute) navigateToDefault()
} else if (opts.defaultRoute) {
navigateToDefault()
} else {
cb()
}
// Listen to popstate
return this
}
Expand Down

0 comments on commit 3ecc838

Please sign in to comment.