Skip to content

Instantly share code, notes, and snippets.

@zmcartor
Created January 24, 2012 13:19
Show Gist options
  • Save zmcartor/1670138 to your computer and use it in GitHub Desktop.
Save zmcartor/1670138 to your computer and use it in GitHub Desktop.
JS Mixin
var RoundButton = function(radius, label, action) {
this.radius = radius;
this.label = label;
this.action = action;
this.StuffSp = 'hoho';
};
var someStuff = function(){
if(this.hasOwnProperty('StuffSpace')){
throw "not good!!";
return;
}
this.StuffSpace = {
ballz: function(){ console.log('baller!'); }
}
}
//mixin this stuff!
someStuff.call(RoundButton.prototype);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment