From ec97a1cef92d8671e7874555a8e806951836b889 Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Mon, 10 Dec 2012 14:10:41 -0500 Subject: [PATCH] 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. --- backbone.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backbone.js b/backbone.js index 83466006..102f1097 100644 --- a/backbone.js +++ b/backbone.js @@ -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 `$`.