javascript - Does anyone know of a way to dynamically load a qooxdoo module? -
I am using the latest qooxdoo sdk (3.5) and find a way to dynamically load a module load I am trying. Each module will implement an "init" function that creates a window in the application, and from that point on, it is self-contained.
What do I need, the ability to call without any irregular init function? The module already existed. For example, someone uploads a custom module and tries to run it - I have a module's init Need to call the function (or error if call failed)
Any thoughts?
Edit:
Something like this:
function load module (modName) {var mod = new qx.something.loadModule (modName); Mod.init (); }
I have come to know in 3 ways that KuoCdu has to run dynamic code. The first way is through the underlying parts loader. "Parts" are basically a fraction of an app that KuoCadu will actually "actually" from time to time to load - for example, a class that rarely manages the form or dialog box used. Actually not dynamic (in my opinion) which requires the code to be included in the build process, which provides a QQD. It is very clear how it works out of the scope for this answer and, obviously, I am not yet familiar with myself.
The second way is to call the qx.Class.getByName () function. It works like this:
qx.Class.define ("bacon", {extend: qx.core.object, construct: function (foo, bar) {this.foo = foo; } .bar = bar;}}); Var klass = qx.Class.getByName ("bacon"); Var obj = new clas ("foo", "bar"); This.debug (obj.foo);
This method was found on the Qooxdoo mailing list. This method will work for the code included in the building process, and have been started dynamically for the code, but in my opinion, for the simple reason, trump is done by the third method that if you Dynamically starting a new class, you will have to use the 'third way' in any way.
The last method I actually knew was through me to study source code. (The source code is available as part of the desktop download.)
The playground reads the code from the editor and creates an anonymous function outside it, then executes the function. There is a bunch of setups and tear down the playground is around the code below, but I have removed it for short and clarity if you are interested in doing something similar, then I highly I suggest looking at the source code. Dynamic code execution starts with line 810 (Qooxdoo v3.5) within the __updatePlayground function.
var fun; Try {fun = qx.event.GlobalError.observeMethod (new function (code)); } Hold (ex) {} do something with the exception} try {fun.call (); } Hold (Pre) {// Do something with exception}
The code is straightforward and uses "call" to perform anonymous tasks.
Comments
Post a Comment