Hi,
I'm currently working on a widget factory that use definition maps as
config.
As these config maps must be created before my app launches and qx
initializes, I use strings and array following this example:
{class:"some qx className", args:[ contructor args]}
The problem is I don't know how to call the constructor properly after
finding the class by its string name.
When working with functions for instance, it is possible to use the apply
method of the function object to pass arguments as arrays :
my_fun.apply(target_obj, args);
However, it seems impossible in the case of new objects creation.
The only thing I'm able to do is to initilalize a new object first, then
call its constructor method once again with the array args (even though it's
a very special case - this workaround won't work in many cases):
var obj = new classFn();
obj.constructor.apply(obj,myArr);
Any Ideas or solutions ?
Many thanks in advance for your help,
Best,
BenoƮt.
--
View this message in context:
http://qooxdoo.678.n2.nabble.com/pure-js-how-to-create-a-new-object-by-passing-args-as-array-tp5549420p5549420.html
Sent from the qooxdoo mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel