#1579 prevent infinite loop in non-existent default route

This commit is contained in:
Leo 2017-02-03 22:21:14 -05:00
parent 5faa996805
commit 9d5f686bbd
5 changed files with 51 additions and 52 deletions

View file

@ -80,7 +80,7 @@ module.exports = function($window) {
var path = router.getPath()
var params = {}
var pathname = parsePath(path, params, params)
var state = $window.history.state
if (state != null) {
for (var k in state) params[k] = state[k]
@ -103,11 +103,11 @@ module.exports = function($window) {
reject(path, params)
}
if (supportsPushState) $window.onpopstate = debounceAsync(resolveRoute)
else if (router.prefix.charAt(0) === "#") $window.onhashchange = resolveRoute
resolveRoute()
}
return router
}