[Helma-user] static methods of Prototype
Chris Zumbrunn
chris at mocha.ch
Thu Aug 10 17:08:51 CEST 2006
On Aug 10, 2006, at 5:04 PM, Hannes Wallnoefer wrote:
> 2006/8/10, Anton Pirker <helma at gmiatlich.net>:
>
>> The second thing is, that i only have a string containing the name of
>> the prototype. Can i get the Prototype from the string somehow?
>>
>> Something like this:
>>
>> var s = "MyProtoName";
>> var proto = new MagicStuff(s);
>> proto.getStuff();
>
> You should be able to get the prototype constructor via
>
> global[s]
>
> (global is a reference to the global object).
>
> You should be able to invoke the constructor via
>
> new global[s]();
...and the static method via
global[s].getStuff()
Chris
More information about the Helma-user
mailing list