Hi Derrell
I have a similar problem in that my app needs third party libs (tinymce and
CodeMirror, although it used to be ace) and I don't want to preload those
files, partly because I might not need them (e.g. the user doesn't use the
editor) or because I might only know which parts I need at runtime.
I developed an async script loader class that, given an array of script urls
will load them asynchronously and in order, and then call a callback when
all scripts are all ready; it only allows a script to be loaded once, and if
all scripts are loaded it fires the callback again immediately. It knows a
script is already loaded because it gives the element an ID, i.e. it assumes
that it is the only cause of scripts being loaded but it in case some
scripts were already loaded by index.html, it could be made to scan the src
of the existing script tags instead.
This also means that I don't have to distribute the libraries with my app(s)
- libraries like codemirror (or ace) just stay on the server under a path
configured at runtime, and therefore are not in my SVN repo or require a
server specific build before release.
John
From: Derrell Lipman <[email protected]>
Reply-To: qooxdoo Development <[email protected]>
Date: Tuesday, 15 May 2012 01:43
To: qooxdoo Development <[email protected]>
Subject: [qooxdoo-devel] Incorporating many external JavaScript files
Prelude: I'm not working with ace but since the playground uses ace, we can
base this discussion around something familiar and similar. The playground
includes the ace JavaScript files via <script> tags in the playground's
index.html file.
If you wanted to create an independent qooxdoo library called qxace that
wrapped ace (so that various apps, not just the playground, could use it),
and you wanted those qooxdoo apps that were to use qxace to include the
qxace library in the normal way, simply by mentioning its Manifest's name in
the config.json file (i.e. not having to include any ace JavaScript files in
the app's index.html file), how would you organize the qxace library to
accommodate this? Where would you put the ace JavaScript files? How would
you get them loaded?
Assume, for the purpose of this discussion, that there are many ace
JavaScript files, and that ace is under heavy development, so those files
will be updated on a regular basis. We therefore would prefer not to create
a single JavaScript file containing the contents of all of the others, as is
often done with released external packages. We need for the qxace library to
load the many ace JavaScript files, and they must all be loaded and ace
initialized before instances of the classes provided by qxace are
instantiated.
Thanks for your thoughts,
Derrell
----------------------------------------------------------------------------
-- 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