Skip to content

Instantly share code, notes, and snippets.

@onurozkan
Forked from elijahmanor/backbone-sync-override.js
Last active August 29, 2015 14:03
Show Gist options
  • Save onurozkan/3fde8985feebd0d2edec to your computer and use it in GitHub Desktop.
Save onurozkan/3fde8985feebd0d2edec to your computer and use it in GitHub Desktop.
// The following could have been replaced by setting `Backbone.emulateHTTP = true;`
Backbone._sync = Backbone.sync;
Backbone.sync = function( method, model, options ) {
var beforeSend = options.beforeSend;
options = options || {};
options.success = function(){
options.Count = xhr.getResponseHeader("Count")
}
return Backbone._sync( method, model, options );
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment