Skip to content

Instantly share code, notes, and snippets.

@benshimmin
Created April 25, 2012 09:17
Show Gist options
  • Save benshimmin/2488427 to your computer and use it in GitHub Desktop.
Save benshimmin/2488427 to your computer and use it in GitHub Desktop.
Backbone - determine whether a model's property has changed from its default
// Since Backbone.Model's hasChanged() function only works after "change" events...
Backbone.Model.prototype.hasDefaultChanged = function(prop) {
return this.defaults[prop] !== this.get(prop);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment