I'd say it's a timing issue. At the time when the code

     period: d3.time.day

is executed, the d3 script has not finished loading (and being 
evaluated). I think this is the fate of scripts loaded dynamically by 
inserting "script" element in the DOM: The evaluation order is no longer 
enforced by the insertion order. Modern browsers load and evaluate in 
parallel. (The source version has the same issue, but probably works as 
the loading of qooxdoo class code takes more time).

For qooxdoo classes, this can be ameliorated as the qooxdoo loader has 
something called "closure parts", where scripts are loaded in parallel, 
but their evaluation only registers their code with qooxdoo, and after 
all scripts have been loaded, qooxdoo's runtime evaluates them in order.

This of course depends on the scripts playing nicely with the qooxdoo 
runtime, which is obviously not the case with 3rd party scripts. A 
possible approach to tackle this might be to wrap the entire 3rd party 
module in a qooxdoo class, which handles the loading, and then use the 
wrapper class throughout of your code. The wrapper class could provide 
means to check the loading status, like firing an event or providing a 
predicate (".d3HasLoaded"), which you would deploy in the using code. 
This would also get you rid of the "add-script" entries in your config. 
Have a look at qooxdoo libs that wrap 3rd party scripts in [1], like  
QxJqPlot, QxDyGraphs and QxProtovis, maybe you find them inspiring.

If you want a simpler approach, the first thing I would try would be to 
remove the reference to the d3 class from the load-time location as a 
map value, e.g. by setting

   period: null

and then in the constructor of abc.core.View add

   this.period = d3.time.day

The function wrapping you tried has the same effect, but the constructor 
approach is in my view more natural, unless, of course, you actually 
intend to share the d3.time.day object across all instances of your class.

T.

[1] http://qooxdoo.org/contrib/project


On 08/28/2012 09:00 AM, non wrote:
> Maybe one step further:
> I turned off all optimizations and debugged the build version a little:
>
> Inside a class of abc.core:
>
> -----------------------------------------------------------
>
> qx.Class.define("abc.core.View", {
>       extend : abc.core.AbstractView, 
>
>       statics : {
>               period : d3.time.day,
>
> -------------------------------------------------------------
>
> This is the first place, where loading interrupts. If I wrap the d3 function
> loading continues:
>
>
> ------------------------------------------------------
>
> qx.Class.define("abc.core.View", {
>       extend : abc.core.AbstractView, 
>
>       statics : {
>               period : function() { return d3.time.day },
>
> -------------------------------------------------------
>
>
> Do I really have to wrap all references to external libs?
> Those involved in class building?
>
> If I guess right, loading will successfully continue and finish, if I wrap
> all references and then the add-script part is executed and all script tags
> get inserted.
> If I'm right, can you advise, which parts of the class definition should be
> wrapped that way?
>
>
>
>
>
>
>
>
>
>
>
> --
> View this message in context: 
> http://qooxdoo.678.n2.nabble.com/add-script-css-problem-does-not-insert-script-css-tags-tp7581132p7581134.html
> Sent from the qooxdoo mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
>

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to