Dojo Toolkit
From Wikipedia, the free encyclopedia
The Dojo toolkit is a modular open source JavaScript toolkit (or library), designed to ease the rapid development of JavaScript- or Ajax-based applications and web sites. It was started by Alex Russell in 2004 and is dual-licensed under the BSD License and the Academic Free License. The Dojo Foundation is a non-profit organization designed to promote the adoption of the toolkit.
Contents |
[edit] Features
[edit] Widgets
Dojo widgets are prepackaged components of JavaScript code, HTML markup and CSS style declarations that can be used to add various interactive features to a website:
- Menus, tabs and tooltips.
- A calendar-based date selector, a time selector, and a clock.
- Sortable tables, dynamic charts and general 2-D vector drawings.
- Tree widgets supporting drag-and-drop.
- An inline rich text editor.
- Various comfortable forms, and routines for validating form input.
- Animated effects like fades, wipes and slides, and facilities for constructing custom animation effects.
[edit] Asynchronous communication
One important feature of Ajax applications is asynchronous communication of the browser with the server: information is exchanged and the page's presentation is updated without a need for reloading the whole page. Traditionally, this is being done with the JavaScript command XMLHttpRequest. Dojo provides an abstracted wrapper (dojo.io.bind
) around various web browsers' implementations of XMLHttpRequest, which can also use other transports (such as IFrames) and a variety of data formats. Using this approach, it becomes easy to have the data a user enters into a form sent to the server "behind the scenes"; the server can then reply with some JavaScript code that updates the presentation of the page.
[edit] JavaScript programming
A number of Dojo features facilitate the programming in JavaScript:
- Abstraction of the execution environment; Dojo provides facilities for detecting and dealing with the differences between various web browsers and other JavaScript execution environments (such as Rhino).
- Dojo supports the development and distribution of custom reusable widgets and includes a library of DOM manipulation utilities.
- An event system which allows code to be marked for execution not only on DOM events but on arbitrary events such as calls to a particular function; this enables more robust use of aspect-oriented programming than is typically seen in JavaScript.
- An abstracted interface for the manipulation of JavaScript classes which provides subclassing functionality and allows extension of existing classes through a set of utility functions instead of direct manipulation of object prototypes.
[edit] Packaging system
Dojo provides a packaging system to facilitate modular development of functionality in individual packages and sub-packages; the base Dojo "bootstrap" script initializes a set of hierarchical package namespaces -- "io", "event", etc. -- under a root "dojo" namespace. After initialization of the root namespace any Dojo package can be loaded (via XMLHttpRequest or other similar transport) by using utility functions supplied in the bootstrap. It is also possible to initialize additional namespaces within or parallel to the "dojo" namespace, allowing extensions of Dojo or the development of private Dojo-managed namespaces for third-party libraries and applications.
Dojo packages can consist of multiple files, and can specify which files constitute the entire package. Any package or file can also specify a dependency on other packages or files; when the package is loaded, any dependencies it specifies will also be loaded.
Workarounds for cross-domain loading of most Dojo packages are provided (though this requires a specialized build of Dojo).
Dojo also provides a mechanism for building "profiles"; the build system takes as input a list of packages, and uses Apache Ant to create a single compressed JavaScript file containing those packages and all their dependencies. This allows all necessary code to be loaded and initialized at once, and permits caching of the code (most web browsers do not cache files loaded via XMLHttpRequest). Pre-built profiles for some common use cases are available for download from the same location as the full toolkit.
[edit] Dojo Foundation and Sponsorship
Both IBM[1] and Sun Microsystems[2] have announced official support for Dojo, including code contributions.
The Dojo Foundation is a 501(c)(6) non-profit organization founded to promote the adoption of the Dojo Toolkit. Its sponsors and members are:
- IBM
- JotSpot
- SitePen
- Renkoo
- AOL
- TurboAjax
- OpenLaszlo
[edit] Criticism
A common criticism of Dojo is the lack of comprehensive documentation; various members of the Dojo community have made efforts to improve the quality of available documentation for the toolkit, but as of October 2006, no comprehensive documentation is available.
[edit] References
[edit] External links
- dojotoolkit.org, official Dojo site, with demos
- Dojo Toolkit manual
- Dojo Toolkit API
- Dojo Wiki
- Dojo Foundation
- Infoworld review of Ajax toolkits, 31 July 2006