Created
December 18, 2013 17:34
-
-
Save acatl/8026494 to your computer and use it in GitHub Desktop.
backbone mixins
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 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