Skip to content

Instantly share code, notes, and snippets.

@GCheung55
Created May 13, 2011 19:39
Show Gist options
  • Save GCheung55/971178 to your computer and use it in GitHub Desktop.
Save GCheung55/971178 to your computer and use it in GitHub Desktop.
Dynamic arguments to instantiate Class. Thanks Keeto!
Class.instantiate = function(C){
C.$prototyping = true;
var instance = new C;
delete C.$prototyping;
return instance;
};
var instance = Class.instantiate( someClass );
instance.initialize.apply(instance, arguments);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment