Skip to content

Instantly share code, notes, and snippets.

@linus-amg
Created November 24, 2014 18:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save linus-amg/1aefdae8ce288bb720f2 to your computer and use it in GitHub Desktop.
Save linus-amg/1aefdae8ce288bb720f2 to your computer and use it in GitHub Desktop.
view = Marionette.ItemView.extend({
initialize: function() {
this.listenTo(this.model, 'change:detail', this.calculateTotal);
this.listenTo(this.model, 'change:total', this.render);
},
calculateTotal: function() {
var newTotal = calc();
this.model.set('total', newTotal);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment