Skip to content

Instantly share code, notes, and snippets.

@TechnotronicOz
Created March 11, 2014 20:54
Show Gist options
  • Select an option

  • Save TechnotronicOz/9494837 to your computer and use it in GitHub Desktop.

Select an option

Save TechnotronicOz/9494837 to your computer and use it in GitHub Desktop.
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