Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update crossroads.js #180

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions dev/src/crossroads.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
},

addRoute : function (pattern, callback, priority) {
var route = new Route(pattern, callback, priority, this);
let route = new Route(pattern, callback, priority, this);
this._sortedInsert(route);
return route;
},
Expand All @@ -50,7 +50,7 @@
},

removeAllRoutes : function () {
var n = this.getNumRoutes();
let n = this.getNumRoutes();
while (n--) {
this._routes[n]._destroy();
}
Expand All @@ -68,7 +68,7 @@
return;
}

var routes = this._getMatchedRoutes(request),
let routes = this._getMatchedRoutes(request),
i = 0,
n = routes.length,
cur;
Expand All @@ -95,7 +95,7 @@
},

_notifyPrevRoutes : function(matchedRoutes, request) {
var i = 0, prev;
let i = 0, prev;
while (prev = this._prevRoutes[i++]) {
//check if switched exist since route may be disposed
if(prev.route.switched && this._didSwitch(prev.route, matchedRoutes)) {
Expand All @@ -105,7 +105,7 @@
},

_didSwitch : function (route, matchedRoutes){
var matched,
let matched,
i = 0;
while (matched = matchedRoutes[i++]) {
// only dispatch switched if it is going to a different route
Expand All @@ -117,7 +117,7 @@
},

_pipeParse : function(request, defaultArgs) {
var i = 0, route;
let i = 0, route;
while (route = this._piped[i++]) {
route.parse(request, defaultArgs);
}
Expand All @@ -129,14 +129,14 @@

_sortedInsert : function (route) {
//simplified insertion sort
var routes = this._routes,
let routes = this._routes,
n = routes.length;
do { --n; } while (routes[n] && route._priority <= routes[n]._priority);
routes.splice(n+1, 0, route);
},

_getMatchedRoutes : function (request) {
var res = [],
let res = [],
routes = this._routes,
n = routes.length,
route;
Expand Down