Dojo Goodness, Part 7 (Injecting Dojo After Page Load)

Matthew Russel post the seventh part of his article about Dojo Javascript library. In this chapter he showwws how to inject the Dojo after the page loads. Here's the one of the examples from this article:

JavaScript

/protect our handiwork within the scope of an anonymous function...
(function() {
//load Dojo (after the page's onload event has already occurred)
djConfig = {afterOnLoad : true, require:['dojo.date','dojo.cookie']};
var e = document.createElement("script");
e.type = "text/javascript";
e.src= "http://o.aolcdn.com/dojo/1.1/dojo/dojo.xd.js";
document.getElementsByTagName("head")[0].appendChild(e);

/* Whenever Dojo has loaded, go about your business. */
})()

You can read the full version of this article on the ONLamp site.