Skip to content

Commit

Permalink
Check current route against hash instead of all routes
Browse files Browse the repository at this point in the history
When you add a new route reload is called. If any route
matches the hash the route callback will be called every
single time a new route is added. Rather than call
reload we should check that the hash matches the
current route and call or ignore it instead.
  • Loading branch information
NicholasEymann committed Sep 7, 2016
1 parent 84fc79e commit 936436f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions dist/routie.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@ var Routie = function(w, isModule) {
var routie = function(path, fn) {
if (typeof fn == 'function') {
addHandler(path, fn);
routie.reload();
checkRoute(getHash(), map[path]);
} else if (typeof path == 'object') {
for (var p in path) {
addHandler(p, path[p]);
checkRoute(getHash(), map[p]);
}
routie.reload();
} else if (typeof fn === 'undefined') {
routie.navigate(path);
}
Expand Down
2 changes: 1 addition & 1 deletion dist/routie.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 936436f

Please sign in to comment.