Skip to main content

using loadScript or equivalent function to load dependent library

2 replies [Last post]
shridharns
Offline
Joined: 2006-07-05

The jmaki.loadScript API is missing in the 1.8 and 1.8.1 version of the jMaki
release that can be used to load library dependency.

The above API is mentiond in jsdocs at:
https://ajax.dev.java.net/jsdocs/Jmaki.html#loadScript

The usage is mentioned at:
https://ajax.dev.java.net/widget-developer.html#config

The API loadStyle is present and loadScript should be similar to this one. I am wondering if anyone else posed the same problem and found any work around?

Thanks,
Shridhar

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
gmurray71
Offline
Joined: 2003-07-31

Hi Sridhar,

The function got changed in jMaki 1.x and later jMaki to:

jmaki.addLibrary

We need to update our docs to match.

jMaki 1.x and greater use an API that lets you load a set of dependent styles using a format like:

jmaki.addLibraries( { libs : _libs, callback : function() { }, cleanup : false});

Where libs is an array of strings of the scripts to be loaded. These scripts can be relative or external

Where callback is the function called when all the scripts are loaded

Where cleanup will remove the dom elements when the scripts are done loading.

One important thing to note is that if any of the libraries fails the next script will not load. If any of the libraries fails to load the callback will not be called. We do not have any timeouts (as of yet) for failed library loading. In the future I am considering having an onerror handler and a timeout but right now the API is not there.

This API is very powerful and can load pretty much any set of scripts consistently. We use it with the jMaki Injector and the jMaki HTML widget loader.

Sorry about the docs, well try to get them updated.

-Greg

shridharns
Offline
Joined: 2006-07-05

Hi Greg,

Sorry for the delay in responding. I was hoping to get a mail alert when there is a reply for the post :(

I will try the changes suggested and update you.

Thanks,
Shridhar