loading 3rd party libraries before qooxdoo's code

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

loading 3rd party libraries before qooxdoo's code

Sanne Peters
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: loading 3rd party libraries before qooxdoo's code

Mustafa Sak-5

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:[hidden email]]
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: loading 3rd party libraries before qooxdoo's code

Sanne Peters
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 [[hidden email]]
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
[hidden email]
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: loading 3rd party libraries before qooxdoo's code

Mustafa Sak-5

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:[hidden email]]
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 [[hidden email]]
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
[hidden email]
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: loading 3rd party libraries before qooxdoo's code

Alex Gölkel
Hi,

if you don't want to wrap the external scripts with qooxdoo classes, you can also use the "add-script" configuration for the generator jobs.
http://manual.qooxdoo.org/current/pages/tool/generator/generator_config_ref.html#pages-tool-generator-generator-config-ref-add-script

Looks like this in my config.json:

 "jobs" :
  {
[...]
    "build" :
    {
      "add-script" :
      [
        {
          "uri" : "script/dateformat.js"
        },
        {
          "uri" : "script/rsapkcs1.js"
        }
      ]
    },
   

Regards
Alex
Reply | Threaded
Open this post in threaded view
|

Re: loading 3rd party libraries before qooxdoo's code

Sanne Peters
In reply to this post by Mustafa Sak-5
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 [[hidden email]]
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 [[hidden email]]
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
[hidden email]
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
[hidden email]
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: loading 3rd party libraries before qooxdoo's code

Mustafa Sak-5
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 [[hidden email]]
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:[hidden email]]
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:[hidden email]]
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

[hidden email]<mailto:[hidden email]>

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
[hidden email]<mailto:[hidden email]>
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: loading 3rd party libraries before qooxdoo's code

Sanne Peters
Hi Mustafa,

I'll be sure to try that out, thanks for al the help!

Sanne

On 17/10/2014 13:20, 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 [[hidden email]]
> 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:[hidden email]]
> 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:[hidden email]]
> 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
>
> [hidden email]<mailto:[hidden email]>
>
> 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
> [hidden email]<mailto:[hidden email]>
> 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
> [hidden email]
> 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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: loading 3rd party libraries before qooxdoo's code

Varol Okan
In reply to this post by Mustafa Sak-5
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 [[hidden email]]
> 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:[hidden email]]
> 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:[hidden email]]
> 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
>
> [hidden email]<mailto:[hidden email]>
>
> 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
> [hidden email]<mailto:[hidden email]>
> 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
> [hidden email]
> 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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: loading 3rd party libraries before qooxdoo's code

Sanne Peters
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 [[hidden email]]
>> 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:[hidden email]]
>> 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:[hidden email]]
>> 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
>>
>> [hidden email]<mailto:[hidden email]>
>>
>> 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
>> [hidden email]<mailto:[hidden email]>
>> 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
>> [hidden email]
>> 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
> [hidden email]
> 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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: loading 3rd party libraries before qooxdoo's code

Loren Schlomer-2
index.html is copied from source to build every time you build, so any changes you make to index.html under source are always reflected in build.



On October 17, 2014 6:16:04 AM PDT, Sanne Peters <[hidden email]> wrote:
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 [[hidden email]]
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:[hidden email]]
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:[hidden email]]
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

[hidden email]<mailto:[hidden email]>

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
[hidden email]<mailto:[hidden email]>
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
[hidden email]
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
[hidden email]
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
[hidden email]
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: loading 3rd party libraries before qooxdoo's code

halcwb
In reply to this post by Alex Gölkel
I added the add-scripts, and it works for the source, only when testing the app, it fails

P.s. to be sure, I added the add-script to all jobs.
Reply | Threaded
Open this post in threaded view
|

Re: loading 3rd party libraries before qooxdoo's code

halcwb
halcwb wrote
I added the add-scripts, and it works for the source, only when testing the app, it fails

P.s. to be sure, I added the add-script to all jobs.
Sorry, some additional reading learned that I had to add the following to the jobs config:

    "testrunner::source-tests-script":
    {
      "add-script":
      [
        {
        "uri": "./../../source/resource/lib/underscore/Underscore.js"
        }
      ]
    },

    "testrunner::build-tests-script":
    {
      "add-script":
      [
        {
        "uri": "./../../source/resource/lib/underscore/Underscore.js"
        }
      ]
    },

Now, it is running fine, only have to get rid of the warinings. I am using coffeescript, so, adding a directive as a comment is tricky as the # is the comment directive in coffeescript.
Reply | Threaded
Open this post in threaded view
|

Re: loading 3rd party libraries before qooxdoo's code

halcwb
In reply to this post by Alex Gölkel
Alex Gölkel wrote
Hi,

if you don't want to wrap the external scripts with qooxdoo classes, you can also use the "add-script" configuration for the generator jobs.
http://manual.qooxdoo.org/current/pages/tool/generator/generator_config_ref.html#pages-tool-generator-generator-config-ref-add-script

Looks like this in my config.json:

 "jobs" :
  {
[...]
    "build" :
    {
      "add-script" :
      [
        {
          "uri" : "script/dateformat.js"
        },
        {
          "uri" : "script/rsapkcs1.js"
        }
      ]
    },
   

Regards
Alex
The add-script directive works fine except for some caveats:

1. As stated before, I needed to add this directive to all the build jobs in the config json, including the test building.
2. The add-script doesn't guarantee when the external script will be loaded. That resulted in a problem when using the external script in a static property. It seems that qooxdoo evaluates static properties at class creation, and this is performed before all scripts are loaded.

Therefore, this code failed:

qx.Class.define 'genpres.lib.request.Users',

  statics:

    service: _.partial informedica.io.remote.Rpc.callRpcServer, 'Users'

    allUsers: (callback, scope) ->
      callback = _.bind(callback) if scope
      @service 'GetAllUsers', callback

with an undefined _ right after loading the app script.

Then this was the solution:
qx.Class.define 'genpres.lib.request.Users',

  statics:

    service: -> _.partial informedica.io.remote.Rpc.callRpcServer, 'Users'

    allUsers: (callback, scope) ->
      callback = _.bind(callback) if scope
      @service() 'GetAllUsers', callback
 
So, changing the property value to a function, preventing the evaluation at class definition.