Datasheet

Chapter 1: Enhancing Development with Dojo Core
Figure 1-4
eventually find it useful to tie into this system and build your own widgets and declaratively driven
modules.
Examining Dojo Core
Now that you’ve gotten a foot in the Dojo, it’s time to back up a little and take a closer look at what Dojo
core offers to a JavaScript developer. The other aspects touched upon in the initial sample will return
throughout the rest of this part of the book.
Declaring, Loading, and Providing Dependencies
Defining modules, declaring dependencies, and dynamically loading code is a key facet of Dojo. What’s
especially nice, though, is that you can use these facilities in your own projects.
Using dojo.require() to Declare and Load Dependencies
You’ve already seen part of this system in action with
dojo.require()
, used like so:
dojo.require("dojo.parser");
dojo.require("dijit.form.TextBox");
dojo.require("dijit.form.CheckBox");
dojo.require("dijit.form.DateTextBox");
dojo.require("dijit.form.NumberSpinner");
dojo.require("dijit.form.Slider");
dojo.require("dijit.layout.AccordionContainer");
These statements resulted in dynamically constructed
<script>
inserted into the
<head>
of the page.
There’s a bit more to it than that, but this is the basic idea. To derive the URL for the include, the following
8