Hi Varol, Because the included script is used in the theme and the theme is run before the code in the Application class and all your examples can only be run when the Application class is loaded.
Unless I am wrong. If I am please explain why, because that would solve my problem. Secondly a custom script tag in the index.html is not copied to a build version and therefore not maintainable. Sanne On 17/10/2014 13:32, Varol Okan wrote: > Hey, > > 1st question I'd have is why would a include through the script tag not > be maintainable ? Seems odd. > > Second there are a multitude of ways to include a script Using QooxDoo > you could use qx.bom.request.Script( ); > > A very simple function would be: > function require ( files, clb, ctx, pre ) { > var load = function ( list ) { > if ( list.length === 0 ) { > if ( clb ) > clb.call ( ctx ); > return; > } > var res = list.shift ( ); > var uri = pre ? pre : ""; uri += res; > var loader = new qx.bom.request.Script ( ); > loader.onload = function() { > load ( list ); > }; > loader.open ( "GET", uri ); > loader.send ( ); > }; > load ( files ); > }; > > invoke it like: > require ( [ "scriptA.js", "scriptB.js"], function ( ) { > console.log ( "Done Loading" ); > }, "path/to/scripts/" ); > > Of course you could use requirejs itself ... > > Varol :) > http://www.AstraNOS.org > > On 10/17/2014 07:20 AM, Mustafa Sak wrote: >> Hi, >> >> all classes will be put together in one file on build version, even the >> theme classes. The generator will resolve the dependencies to your >> libraries, too. If you don't want to use the full namespace of the library >> class inside your theme, just use the @require[1] generator directive on top >> of your theme class to instruct the generator to include the library class >> code first. >> >> >> [1] >> http://manual.qooxdoo.org/devel/pages/development/api_jsdoc_ref.html?highlight=require#require >> >> Gruß >> Mustafa >> >> ________________________________________ >> Von: Sanne Peters [sa...@realtimesolutions.nl] >> Gesendet: Freitag, 17. Oktober 2014 11:28 >> An: qooxdoo Development >> Betreff: Re: [qooxdoo-devel] loading 3rd party libraries before qooxdoo's >> code >> >> Hi Mustafa, >> >> Does that mean that a qooxdoo library (say for example a vanilla javascript >> library), >> will be loaded before my custom defined theme if it has no real dependencies? >> >> Also: >> "The generator will concatenate all used classes of libraries into the >> application JS-file ordered by the dependency analysis" >> Isn't the application class loaded independently of the theme of the Qooxdoo >> application? If so this causes some issues with my theme, because I would be >> calling a class' method that would not be loaded yet. >> >> I know these are two question instead of one, but still.. >> >> Sanne >> >> >> On 16/10/2014 15:36, Mustafa Sak wrote: >> Hi Sanne, >> >> any qooxdoo project / application can be bound as a library into any other >> qooxdoo app. [1] >> The name space of the library will be available on the main application. The >> generator will concatenate all used classes of libraries into the >> application JS-file ordered by the dependency analysis. [2] >> >> [1] >> http://manual.qooxdoo.org/devel/pages/tool/generator/generator_config_ref.html?highlight=config%20generator#library >> [2] >> http://manual.qooxdoo.org/devel/pages/development/library_custom.html?highlight=libraries >> >> Gruß >> Mustafa Sak >> >> Applications & Integration >> >> 1&1 Internet AG >> Ernst-Frey-Straße 10 >> DE-76135 Karlsruhe >> >> Von: Sanne Peters [mailto:sa...@realtimesolutions.nl] >> Gesendet: Donnerstag, 16. Oktober 2014 11:19 >> An: qooxdoo Development >> Betreff: Re: [qooxdoo-devel] loading 3rd party libraries before qooxdoo's >> code >> >> Hi Mustafa, >> >> How does wrapping my library in a qooxdoo library solve my problem? >> >> Sanne >> >> On 16/10/2014 10:42, Mustafa Sak wrote: >> Hi, >> >> The loader will load all scripts included via add-script asynchronously. In >> source mode your scripts will be loaded before qooxdoo code, because all >> scripts will be loaded async. But in build mode the code is directly >> included into the loader and will be executed synchronously. >> >> The only advice I can give you is to wrap your third party lib as a qooxdoo >> library. >> >> Gruß >> Mustafa Sak >> >> Applications & Integration >> >> 1&1 Internet AG >> Ernst-Frey-Straße 10 >> DE-76135 Karlsruhe >> >> Von: Sanne Peters [mailto:sa...@realtimesolutions.nl] >> Gesendet: Donnerstag, 16. Oktober 2014 09:56 >> An: qooxdoo Development >> Betreff: [qooxdoo-devel] loading 3rd party libraries before qooxdoo's code >> >> Hi all, >> >> I've got a third party (ish) library (that I made myself) from which I use >> some functions in my custom theme. >> >> At first I manually added a script tag to the code so that ran the code >> before the qooxdoo code was run and the function was of course available to >> the theme. >> >> like so: >> >> <!DOCTYPE html> >> <html> >> <head> >> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> >> <title>PlanningTool</title> >> <script type="text/javascript" src="3rd-party/em.js"></script> >> <script type="text/javascript" src="script/my-app.js"></script> >> </head> >> <body></body> >> </html> >> >> But that is not very maintainable.... >> >> So I decided to let qooxdoo's build system take care of it like so: >> >> "source-hybrid" : >> { >> "add-script" : [{ "uri" : "3rd-party/em.js" }] >> } >> >> >> but this adds the script after the qooxdoo code... which is exactly what I >> do not want. Is there a way I can tweak/set the build system to make it do >> what I want? >> >> thanks in advance, >> >> Sanne >> >> >> >> >> ------------------------------------------------------------------------------ >> >> Comprehensive Server Monitoring with Site24x7. >> >> Monitor 10 servers for $9/Month. >> >> Get alerted through email, SMS, voice calls or mobile push notifications. >> >> Take corrective actions from your mobile device. >> >> http://p.sf.net/sfu/Zoho >> >> >> >> >> _______________________________________________ >> >> qooxdoo-devel mailing list >> >> qooxdoo-devel@lists.sourceforge.net<mailto:qooxdoo-devel@lists.sourceforge.net> >> >> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel >> >> >> >> >> ------------------------------------------------------------------------------ >> Comprehensive Server Monitoring with Site24x7. >> Monitor 10 servers for $9/Month. >> Get alerted through email, SMS, voice calls or mobile push notifications. >> Take corrective actions from your mobile device. >> http://p.sf.net/sfu/Zoho >> >> >> >> _______________________________________________ >> qooxdoo-devel mailing list >> qooxdoo-devel@lists.sourceforge.net<mailto:qooxdoo-devel@lists.sourceforge.net> >> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel >> >> >> ------------------------------------------------------------------------------ >> Comprehensive Server Monitoring with Site24x7. >> Monitor 10 servers for $9/Month. >> Get alerted through email, SMS, voice calls or mobile push notifications. >> Take corrective actions from your mobile device. >> http://p.sf.net/sfu/Zoho >> _______________________________________________ >> qooxdoo-devel mailing list >> qooxdoo-devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel > > ------------------------------------------------------------------------------ > Comprehensive Server Monitoring with Site24x7. > Monitor 10 servers for $9/Month. > Get alerted through email, SMS, voice calls or mobile push notifications. > Take corrective actions from your mobile device. > http://p.sf.net/sfu/Zoho > _______________________________________________ > qooxdoo-devel mailing list > qooxdoo-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel ------------------------------------------------------------------------------ Comprehensive Server Monitoring with Site24x7. Monitor 10 servers for $9/Month. Get alerted through email, SMS, voice calls or mobile push notifications. Take corrective actions from your mobile device. http://p.sf.net/sfu/Zoho _______________________________________________ qooxdoo-devel mailing list qooxdoo-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel