Skip to content

Instantly share code, notes, and snippets.

View derek-watson's full-sized avatar

Derek Watson derek-watson

View GitHub Profile
@derek-watson
derek-watson / gist:3060402
Created July 6, 2012 14:13 — forked from mattheworiordan/gist:1037984
Backbone patch to defer update method requests when new create requests are not complete on a model
(function() {
function proxyAjaxEvent(event, options, dit) {
var eventCallback = options[event];
options[event] = function() {
// check if callback for event exists and if so pass on request
if (eventCallback) { eventCallback(arguments) }
dit.processQueue(); // move onto next save request in the queue
}
}
Backbone.Model.prototype._save = Backbone.Model.prototype.save;