Skip to content

Commit

Permalink
Revert "Revert "Revert "Support next from Connect middleware."""
Browse files Browse the repository at this point in the history
This reverts commit 21069a0.

Conflicts:

	bones.js
  • Loading branch information
Young Hahn committed Mar 7, 2011
1 parent aa62ac3 commit 0577386
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions bones.js
Expand Up @@ -66,24 +66,24 @@ Backbone.Controller = Backbone.Controller.extend({
route: function(route, name, callback) {
Backbone.history || (Backbone.history = new Backbone.History);
if (!_.isRegExp(route)) route = this._routeToRegExp(route);
Backbone.history.route(route, _.bind(function(fragment, res, next) {
Backbone.history.route(route, _.bind(function(fragment, res) {
var response = function(view) {
res.send(view.html());
};

var args = this._extractParameters(route, fragment);
var view = callback.apply(this, args.concat([response, next]));
var view = callback.apply(this, args.concat([response]));
this.trigger.apply(this, ['route:' + name].concat(args));
}, this));
}
});

// Override `.loadUrl()` to allow `res`, `next` objects to be passed through
// Override `.loadUrl()` to allow `res` response object to be passed through
// to handler callback.
Backbone.History.prototype.loadUrl = function(fragment, res, next) {
Backbone.History.prototype.loadUrl = function(fragment, res) {
var matched = _.any(this.handlers, function(handler) {
if (handler.route.test(fragment)) {
handler.callback(fragment, res, next);
handler.callback(fragment, res);
return true;
}
});
Expand All @@ -98,7 +98,7 @@ Backbone.History.prototype.middleware = function(req, res, next) {
} else {
fragment = req.url;
}
!Backbone.history.loadUrl(fragment, res, next) && next();
!Backbone.history.loadUrl(fragment, res) && next();
};

// Clear out unused/unusable methods.
Expand Down

0 comments on commit 0577386

Please sign in to comment.