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.



--
View this message in context: 
http://qooxdoo.678.n2.nabble.com/loading-3rd-party-libraries-before-qooxdoo-s-code-tp7586291p7586574.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to