While the JavaScript language is dynamic, powerful, and extremely expressive, there are still issues that come up about portability. Any code that you develop has to maintained, updated, and debugged. For this we need a standard among the JavaScript codes that we made, and the use of tool kit approach evolves here. The use of a standard JavaScript library gives compatibility amongst browsers for various feature sets. While we are attempting to develop a feature that works uniformly across a set of commonly used browsers, it will be a tedious work that often demoralizes even the most experienced professionals.

Toolkit

A tool kit is nothing but  a set of JavaScript files which include standard functions and utilities.

Dojo Toolkit is an open source java script library to ease the development of cross platform JavaScript / Ajax based applications and web sites. It is started by Alex Russell, Dylan Schliemann, David Schnitzler, and others in 2004. The Dojo Foundation is a non-profit organization to promote the adoption of the dojo toolkit.

Architecture

javascript dojo

javascript dojo

Base

Base is the kernel of the toolkit. Features included in base have been used for utility, speed of execution, and size. Getting base into your web page is as simple as writing a SCRIPT tag.

<script djConfig=”parseOnLoad: true” src=”src/dojo/dojo.js” ></script>

This will load the basic dojo script. Core will be packaged separately as its features are not quite common for all use.

Core

Core builds over Base with additional facilities like parsing widgets, advanced animation effects, drag-and-drop facilities, back-button handling, managing cookies, and more. Resources provide fundamental support for all operations. The module which you have explicitly imported into the page external to dojo.js is actually a part of Core itself. Core facilities usually do not appear in the Base level namespace, and instead appear in a lower-level namespace. This means that dojo includes the package names in an object reference. Like for-each loop function “dojo.lang.forEach (listOfThings, myFunc);” instead of using “for each (listOfThings, myFunc);”.By using namespaces, dojo tool kit ensures that no collisions occur between itself and any other libraries on the same page.

Dijit

Dojo has a library of widgets called Dijit (Dojo widget) that is a ready to use and often  makes no need of writing any JavaScript. Dijit uses commonly accepted accessibility standards such as ARIA (A standard for accomplishing Accessible Rich Internet Applications) and with preconfigured internationalization. Dijit is built upon core, so whenever you need your own custom widget, you can use the very same building blocks that were used to create Dijit features. The widgets are portable and can effectively share or deployed onto any web server. Generally Dijit is a UI element such as a button, text box, scroll bar, calendar, tree etc that are  easy to use, Event handlers can be registered on widget, handle browser incompatibilities and HTML+CSS bound by JavaScript

E.g.

<script>

dojo.require (“dijit.form.DateTextBox”);

</script>

<body>

<input name=”date1″ value=”2009-11-22″ dojoType=”dijit.form.DateTextBox” required=”true” />

</body>

Layout management is one of the powerful features of dojo widgets, Accordion Container, Content Pane, Layout Container, Split Container, Stack Container, Tab Container, and Menu are used for layout management. Dojo form elements include Checkbox Radio Button, Combo Box, Currency Text Box, Date Textbox, Number Text Box, Slider, Validation Textbox, Text area which can effectively manipulated using dojo libraries

E.g

<input length=25 name=”email” dojoType=”dijit.form.ValidationTextBox” lowercase=”true” trim=”true” regExp=”[a-z0-9._%+-] +@ [a-z0-9-]+\.[a-z]{2,4}”  required=”true” invalid Message=”Please enter valid e-mail id”/>

Dojo X

DojoX is a collection of subprojects that officially called by “Dojo Extensions” .The subprojects in DojoX are stable widgets and resources that is extremely valuable and fit nicely into Core or Dijit. DojoX frequently comes with collections, Charting algorithms and various String manipulations scripts

Dojo has a lot of good features like WYSIWYG editors, Clocks, Layout Managers, Buttons, Color pickers, and many other things. Then there’s the encryption package, hashing for server-side, the Drag-n-Drop package, the essential Collections API with Java-like iterators, the powerful   Ajax functionality. You might think that using a JavaScript-based framework is quiet simple, but still developer has to build some proficiency in JavaScript. There comes the cons of tool kit which have tedious code, but still the toolkit approach gives you the freedom of using it with any server side technology and it takes care of browser problems which often is a big headache for developers and it can be used with other standard frame works.