Created
September 16, 2011 21:06
-
-
Save jondavidjohn/1223151 to your computer and use it in GitHub Desktop.
John Resig's Class instatiator
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
// makeClass - By John Resig (MIT Licensed) | |
function makeClass(){ | |
return function(args){ | |
if ( this instanceof arguments.callee ) { | |
if ( typeof this.init == "function" ) | |
this.init.apply( this, args.callee ? args : arguments ); | |
} else | |
return new arguments.callee( arguments ); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment