marionettejs/backbone.marionette — pull request #764 by jhudson8 (2013-10-30 02:26:39+00:00)
Title: Add mixin support

I believe mixins would be meaningful for marionette views. This would allow scoped encapsulated logic that can be reused but does not have to stick to util methods. While methods can easily be added to the prototype or object instance, mixins are more full featured to include initializers, events and entity bindings.

Mixins can be view classes or simple has structures.
- Properties will be copied to the view instance but will not override existing methods.
- Mixin initializers will be executed with the parent view as the context and the appropriate init options.
- Mixin events hashes are supported
- Mixin model/collection events are supported

*note this could actually be optimized more if the original Backbone delegateEvents were not used. If it were duplicated in marionette we could use a separate domain class name for the parent view and all unique mixins (which will allow for parent vs. mixin undelegation). This would allow us to delegate mixin DOM events w/o undelegating existing DOM event bindings. I did not implement this because I wasn't sure of your stance on the much code duplication.

I'd be curious to hear your feedback. Thanks.