loading third party scripts

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

loading third party scripts

aggieben
I want to load a third party script along with my application (e.g., I have a script called sformat.js which contains a function called String.format which does simple token replacement in format strings).

It seemed like this should be done using the resources mechanism (this seems to be used in the demos), but I couldn't figure out how do load the script.  I placed it in resource/myapp/js/sformat.js, and added an #asset declaration at the top of the file, but what else do I need to do?
Reply | Threaded
Open this post in threaded view
|

Re: loading third party scripts

thron7


aggieben wrote:
> I want to load a third party script along with my application (e.g., I have a
> script called sformat.js which contains a function called String.format
> which does simple token replacement in format strings).
>
> It seemed like this should be done using the resources mechanism (this seems
> to be used in the demos), but I couldn't figure out how do load the script.
> I placed it in resource/myapp/js/sformat.js, and added an #asset declaration
> at the top of the file, but what else do I need to do?
>  
Well, it seems the simplest way is to load it in your index.html, isn't
it?! Placing it in your resource tree is sensible, this assures it is
not touched through clean-up actions. Also, the relative path from the
index.html is easy to figure out, and is stable across source/build
versions. And using a #asset hint for it is also ok, this should result
in the script being copied during 'build' generation. Still the loading
needs to be done separately.

HTH,
T.



------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel