Created
July 23, 2012 19:26
-
-
Save joseanpg/3165651 to your computer and use it in GitHub Desktop.
Who decides who is a jsRockStar?
This file contains 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
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