Skip to content

Instantly share code, notes, and snippets.

@joseanpg
Created July 23, 2012 19:26
Show Gist options
  • Save joseanpg/3165651 to your computer and use it in GitHub Desktop.
Save joseanpg/3165651 to your computer and use it in GitHub Desktop.
Who decides who is a jsRockStar?
function ImTheLeche(legoCreator) {
return function(){
return function(protopato) {
legoCreator.gn = legoCreator.prototype =
Object.create(protopato,{constructor:{value:legoCreator}});
return {init:function(){
var fakeMVCfever =
Object.create(legoCreator.gn,{constructor:{value:this.init}});
return legoCreator.apply(fakeMVCfever,arguments);}
}
}
}();
}
var Duck = ImTheLeche(function Duck(cuak){this.cuak = cuak; return this})
({walk:function(){return this.cuak;}});
duckly = Duck.init('Quark!!');
console.log(duckly.walk());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment