Although you could download Dojo from its official Web presence and set up a local installation, the easiest way to get started is to use the latest version of Dojo that is hosted on AOL's Content Delivery Network (CDN). The following page skeleton demonstrates that the minimal effort required to put Dojo to work from the CDN is a SCRIPT tag that loads Dojo into the HEAD of the page; it is especially noteworthy that the SCRIPT tag incurs the cost of one request to the Web server that delivers a gzipped payload of approximately 29 KB and provides the latest l.l.x release that is available.
In Dojo parlance, the goodies that the SCRIPT tag provides is called Base, because it provides the base for the toolkit, and because everything you'll use is contained in the base-level dojO.'k namespace. Speaking of which, with the exception of the Dojo identifier itself, the global page-level namespace is otherwise preserved:
<! -- isoading Doja req;Jires only one SCETPT tag --) <script. type="text/javascript"
src~''http://o.aolcdn . com/dojofl. 1 /dojo/dojo. xd. j s"> </script>
dojo. addOnLoad I function () {
/' safely use any code that relies on dojo. functions in here ... */
<body>
<a href~''http://dojotoolki t. org">Dojo</ a> </body>
</html>
To summarise, the dojo. addOnLoad block fires once the asynchronous loading of the dojo.xd.js file and any dependencies specified via dojo. require statements (more on these in a bit) have completed, and this is necessary in order to prevent any race conditions that might occur without it.
Basically, the dojo.xd.js file providing Base accomplishes feats such as normalising DaM events and provides you with a number of useful utilities to accelerate application development.




Reply With Quote
Copyright Techfuels
Bookmarks