I'd love to see a new onLoadFunc property, or some similar name, in djConfig. This would allow a script to programmatically grab an xdomain version of dojo that automatically calls the specified function when it's loaded, getting around asynchronous loading issues.
For example, I have a bit of javascript I'd like to be loaded in a single call from third-party pages, and my script uses Dojo. To get around those sites having to include the Dojo script as well as mine in their HTML, I'd like to programmatically load it as in:
function onDojoLoad()
{
alert("Got on Dojo load!!!");
}
djConfig =
{
onLoadFunc: onDojoLoad
};
var element = document.createElement("script");
element.type = "text/javascript";
element.src = "http://ajax.googleapis.com/ajax/libs/dojo/1.1.1/dojo/dojo.xd.js";
document.getElementsByTagName("head")[0].appendChild(element);
{
alert("Got on Dojo load!!!");
}
djConfig =
{
onLoadFunc: onDojoLoad
};
var element = document.createElement("script");
element.type = "text/javascript";
element.src = "http://ajax.googleapis.com/ajax/libs/dojo/1.1.1/dojo/dojo.xd.js";
document.getElementsByTagName("head")[0].appendChild(element);
This would help me out a lot. Is there another way to do the equivalent I'm not aware of? I'm obviously doing the head script insert manually since Dojo's not yet available.
Thanks.
-Adam

There is something like this
There is something like this in Dojo 1.2 (still under development). From the still-in-progress release notes
djConfig.addOnLoad is now supported. Adds a callback via dojo.addOnLoad. Useful when Dojo is added after the page loads and djConfig.afterOnLoad is true.
Supports the same arguments as dojo.addOnLoad. When using a function reference, use:
djConfig.addOnLoad = function(){};
For object with function name use:
djConfig.addOnLoad = [myObject, "functionName"];
and for object with function reference use:
djConfig.addOnLoad = [myObject, function(){}];
great news
Sounds perfect, James, thanks. Looking forward to it!
-Adam