Created
          August 31, 2012 08:26 
        
      - 
      
- 
        Save bergquist/3550221 to your computer and use it in GitHub Desktop. 
    backbone mixin
  
        
  
    
      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 MyBackboneView = Backbone.View.extend({ | |
| .... | |
| }); | |
| var FormMixin = { | |
| prop: '', | |
| getFormValue: function(name) {} | |
| } | |
| _.extend(MyBackboneView.prototype, FormMixin); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
Sätt mixin skit under ett namespace så man enklare kan följa i MyBackboneView att man anropar saker från mixin
var FormMixin = {
_base: {
fieldChanged: function (event) {
var element = $(event.currentTarget),
value = element.val(),
id = element.attr('id');
}
}
MyBackboneView = Backbone.View.extend({
events: {
'change input' : '_base.fieldchanged'
}
});