I've written some stuff do load dynamic js for my personal library.
// hash of namespace names and functions to execute when a namespace
has loaded
BearLib.loadExecuteQueue = new Hash();
// configuration options
BearLib.Config = {
// location of bearlib folder
libraryPath: [your
For anyone coming to this thread later, there's now a (rough) how-to
on the unofficial wiki:
http://proto-scripty.wikidot.com/prototype:how-to-load-scripts-dynamically
-- T.J. :-)
On Oct 16, 11:11 am, T.J. Crowder [EMAIL PROTECTED] wrote:
Hey Jason,
[Call me T.J. :-)]
Caveat: I have not
@T.J:
This was a time saver on the scripts I have to load on my application
as well as have learnt something new
Many thanks ;-)
Regards
Jason
On 10/17/08, T.J. Crowder [EMAIL PROTECTED] wrote:
For anyone coming to this thread later, there's now a (rough) how-to
on the unofficial wiki:
When the script element is inserted into the document body, does the
currently-running script wait for the js file to be downloaded and executed?
You'll want to try it out on the browsers you're targeting, but I tend
to doubt it: All the code inserting the tag is doing is inserting the
script
I mean an amateurish question, please dont get me wrong on it
2008/10/16 jason maina [EMAIL PROTECTED]
@Crowder:
This kind of amateurish, how will the script announce itself?
Kind of don't understand the concept
2008/10/16 T.J. Crowder [EMAIL PROTECTED]
When the script element is
Hey Jason,
[Call me T.J. :-)]
Caveat: I have not had to do this in the wild, so there are sure to
be better answers from others. I'll throw out an example that works
in my limited testing (FF3, IE6, Safari 3, Opera 9):
Loading the script dynamically from the statically-loaded script
already
You can, like this:
document.body.insert(new Element(script, { type: 'text/javascript',
src:'test.js' }))
The fun part is writing a wrapper for all the functions contained in
that script so that they load the script and execute, rather than
fail.
On Oct 15, 7:16 am, jason maina [EMAIL
That's certainly possible, however, you will have to implement the
mechanism for checking which JS files are necessary yourself.
As for method to optionally load JS files, Scriptaculous, for
instance, inserts script tags (see scriptaculous.js).
- Baglan
When the script element is inserted into the document body, does the
currently-running script wait for the js file to be downloaded and executed?
Or does the js file download in the background while the current script
finishes?
-Hector
2008/10/15 buda [EMAIL PROTECTED]
tere is a beautifull
Try Googling around for lazy loading its the idea you're talking
about...
http://ajaxpatterns.org/On-Demand_Javascript
We should write an extension for proto that does this nicely, I
checked out http://www.scripteka.com/ and there is a lazy loading tag
but unfortunately nothing with loading
10 matches
Mail list logo