Created
April 25, 2012 09:17
-
-
Save benshimmin/2488427 to your computer and use it in GitHub Desktop.
Backbone - determine whether a model's property has changed from its default
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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