Created
March 11, 2014 20:54
-
-
Save TechnotronicOz/9494837 to your computer and use it in GitHub Desktop.
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
| var signedView = { | |
| updateSig: function() { | |
| newSig = this.signature(); | |
| if (newSig !== this._signature) { | |
| this._signature = newSig; | |
| return true; | |
| } | |
| return false; | |
| } | |
| } | |
| var myView = Backbone.View.extend(_.extend({ | |
| template: _.template(whatever), | |
| render: function() { | |
| if (this.updateSignature()) { | |
| this.$el.html(this.template(this.model.toJSON())); | |
| } | |
| return this; | |
| }, | |
| signature: function() { | |
| return [ | |
| this.model.get('attr1'), | |
| this.model.get('attr2') | |
| ].join(';'); | |
| } | |
| }, signedView)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment