This part of the book provides a guided tour of Base and Core, the
elements of the toolkit that comprise a powerful JavaScript standard
library. Base is the kernel of the toolkit and is
optimized to include an awesome amount of functionality that comes
across the wire at under 30KB. Every feature included in Base has been
scrutinized for utility, speed of execution, and size. You'll quickly
find that once you start using Base, you won't want to live without
it—nor do you have to: getting Base into your page is as simple as
writing a single SCRIPT
tag that can
even be cross-domain loaded from one of AOL's geographically edge-cached
servers. In addition to providing the logical base of the toolkit,
everything in Base is included in the base-level dojo
namespace, so finding the most commonly
used functions and data members is always just a few keystrokes
away.
Core supplements Base with additional
functionality that you will certainly be using sooner rather than later,
but in an effort to keep Base as lean and mean as possible, Core was
packaged separately because its features are not quite common enough for
all use cases. Still, pulling in resources from Core is just a dojo.require
function call away, which is
similar to #include
from C
programming or import
from Java; from
then on out, it's as though you had it all along. And as you'll see in
Chapter 16 on Util, you can actually
use the Dojo build system to combine exactly which additional non-Base
resources you need into a single script; thus, Core functionality need
not be any further away than Base for production settings. The kinds of
features you'll find in Core include animation machinery (dojo.fx
), drag-and-drop facilities (dojo.dnd
), a data management layer (dojo.data
), cookie handling (dojo.cookie
), and more.
Familiarity with the arsenal of tools in Base and Core is absolutely essential to becoming a productive Dojo developer, and the chances are good that this machinery can supplement your swath of tools and techniques, regardless of their origin or how long you've already been using them. After mastering Base and Core, you'll spend less effort on the common, mundane tasks that many developers squander precious time on, and spend more time on the far more interesting aspects of your project that require creativity and out-of-the-box thinking.
Get Dojo: The Definitive Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.