Skip to content

Instantly share code, notes, and snippets.

@acatl
Created December 18, 2013 17:34
Show Gist options
  • Save acatl/8026494 to your computer and use it in GitHub Desktop.
Save acatl/8026494 to your computer and use it in GitHub Desktop.
backbone mixins
var ViewA = Backbone.View.extend({
events: {
'click .my-button': 'onMyButtonClick'
}
});
var ViewB = Backbone.View.extend({
ui: {
myButton: '.my-button'
}
});
// mixin ViewA into ViewB
_.extend(ViewB.prototype, ViewA.prototype);
var viewB = new ViewB();
console.log(viewB.ui);
console.log(viewB.events);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment