Fixes #1468 -- add a 'request' event that allows folks to watch for spinners etc. Passes the XHR on which you can .then, .error, and so on.

This commit is contained in:
Jeremy Ashkenas
2012-12-10 14:10:41 -05:00
parent 615b08c9e8
commit ec97a1cef9

View File

@@ -1475,7 +1475,9 @@
};
// Make the request, allowing the user to override any Ajax options.
return Backbone.ajax(_.extend(params, options));
var xhr = Backbone.ajax(_.extend(params, options));
model.trigger('request', model, xhr, options);
return xhr;
};
// Set the default implementation of `Backbone.ajax` to proxy through to `$`.