On 05/21/2010 11:49 PM, Alexander Steshenko wrote:
> As I understand when I run *generate.py source* it parses the sources
> and includes all the namespaces/classes that are needed in the generated
> js file.
> That's why, I guess, we have the following in an Application class:
>
> // support native logging capabilities, e.g. Firebug for Firefox
> qx.log.appender.Native;
> // support additional cross-browser console. Press F7 to toggle
> visibility
> qx.log.appender.Console;
>
> i.e. to force including these two classes.
Correct.
> My question is: is there any possibility to "include a class" during the
> runtime. I read about *parts,* I know that for production it's not a
> problem and even for development I can just use *generate.py souce-all
> *. But if possible and easy (I probably missed it) I'd like to make it
> loading "on demand" just to make the development stage a bit more
> comfortable.
> I tried something like this:
>
> // check if the class is defined
> if (!qx.Class.isDefined(controllerClass)) { // let's say controller
> class is a string equal to 'myapp.controller.MainWindow'
> var scriptLoader = new qx.io.ScriptLoader();
> var controllerClassUri = 'class/myapp/' + controllerClass.replace('.',
> '/'); // this should form uri for loading the file with the class. Let's
> assume it really lies there.
> scriptLoader.load(controllerClassUri);
Mh. For one thing, your controllerClassUri ends up being "class/myapp/"
+ "myapp/controller/MainWindow", which is probably not the right path
(repeated 'myapp').
For another, scriptLoader.load() is asynchronous, and you have to
provide a callback function if you want to react on the loading event.
If you try to access the class immediately after the load() call, you
will usually get an error.
T.
------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel