Slides from talk "Getting Started with Dojo Toolkit" at Cologne.JS in August 2010
some sample Dojo Code from my presentation is on http://code.google.com/p/dojodemo/
Cologne.JS is a local JavaScript user group: http://colognejs.de/
1. Getting started with
Dojo Toolkit
Cologne.js
User Group Meeting, Cologne (@cowoco)
Thomas Koch
(@tomy_koch)
10. August 2010
2. Dojo Toolkit: About
• Dojo is JS Framework
– Pure client-side JS (in contrast to GWT etc.)
– Includes Dev.Tools: build, test
– Open source, active community
http://www.dojotoolkit.org/
• Dojo features
– OO-style class based development
– Modularisation (via concept of packages)
– Support for data and GUI MVC
– Wide range of builtin widgets
10.08.2010 Thomas Koch 2
3. Dojo Toolkit: Features
• Development: APIs for robust Web Applications
– Event handling, DOM manipulation
– CSS Querying, Animations, …
• Communication: Ajax and even more
– Data abstraction layer, JSON-RPC, Comet, XMPP etc.
• Integration: with many server-side developments
– including DWR, Django, TurboGears, Google, Jaxer …
• User interface: re-usable gui components
– Standard gui widgets (button, slider, table, tree, menu …)
– vector graphics, charting, …
– theming, drag’n drop, …
– i18N, a11y
• Widely used: Dojo Widgets (aka Dijits)
10.08.2010 Thomas Koch 3
17. Dojo Core
• Extends Dojo Base Framework
– Contains everything from dojo-Namespace
that needs import, e.g. dojo.require(„dojo.date“)
• Important Components
– dojo.dnd: Drag and Drop
– dojo.i18n: Internationalization Utility
– dojo.rpc: Remote Procedure Calls with Backend Servers
– dojo.data: a uniform data access layer
• Furthermore contains…
– dojo.fx: Effects library on top of Base animations
– dojo.gears: Google Gears
– dojo.io: Additional AJAX I/O transports
– dojo.html: Inserting contents in HTML nodes
– Misc: dojo.currency, dojo.date, dojo.number, dojo.regexp etc.
Thomas Koch 10.08.2010 17
18. Dojo Unified Events
• Publish/Subscribe communication
• connect a function of your own to:
– a DOM event, such as when a link is clicked
– an event of an object, such as an animation starting
– a topic, which other objects can publish objects to
– function call of your own, such as bar();
• Methods
– dojo.[dis]connect(), dojo.publish, dojo.subscribe()
• Example var foo = dojo.byId("foo"); // anchor element
dojo.connect(foo, "onclick", function(evt) {
console.log("anchor clicked");
dojo.stopEvent(evt); //suppress navigation
10.08.2010 Thomas Koch 18
});
20. Dojo Documentation
• API Docs
– Online Documentation : http://dojotoolkit.org/api/
• Dojo Campus
– Articles, Tutorials, Feature Explorer … http://dojocampus.org
• Blogs
– Dojo Project Blog
• http://dojotoolkit.org/blog/
– SitePen Blog
• http://www.sitepen.com/blog
– Shane O’Sullivan’s technical blog
• http://shaneosullivan.wordpress.com/
• Books
– Russell, Matthew A.
• Dojo: The Definitive Guide
– Riecke, C.; Gill, R.; Russell, A.
• Mastering Dojo:
– Zammetti, Frank
10.08.2010
• Practical Dojo Projects Thomas Koch 20
21. Dojo Performance
• Dojo Performs Better (DOM Manipulation!)
– Dojo is 1.5-2x faster than jQuery, and the difference is
biggest on the slowest browsers — where it counts most.
siehe TaskSpeed
– http://dante.dojotoolkit.org/taskspeed/
10.08.2010 Thomas Koch 21
22. Dojo Foundation
– http://www.dojofoundation.org/
– home of great open-source projects
– started as the home of
the Dojo Toolkit
– today the Dojo Foundation
is also home of other open
web projects including
cometD, DWR, OpenRecord,
Persevere, and Sizzle.
– Dojo Foundation Board
– vote per committer
10.08.2010 Thomas Koch 22