Introduction to Dojo

Source: Internet
Author: User
Tags command line data structures require versions

Brief introduction

Dojo is one of the Ajax frameworks.

Dojo is a collection of powerful JavaScript libraries that can provide a simple API for many features. One of these features is the ability to generate HTTP requests and receive their responses. In addition to providing AJAX functionality, Dojo provides a number of packages for string manipulation, DOM manipulation, drag-and-drop support, and data structures.

Dojo is an open source DHTML Toolkit implemented in JavaScript language. It was established on the basis of several project contributions (Nwidgets, Burstlib, F (m)), which is why it is called a unified toolkit. The goal of Dojo is to address those, long-standing, historical issues, and DHTML cross-browser problems that are encountered by developing DHTML applications.

Dojo makes it easier for you to make Web pages dynamic, or to play a role in any environment that can stabilize JavaScript language.

Characteristics

Dojo has the following characteristics:

1. Using the components provided by dojo, you can improve your Web application usability, interactivity, and functionality.

2, can also be easier to establish an interactive user interface. At the same time, Dojo provides small dynamic processing tools.

3, using its low-level API and compatible code, can write a lightweight, single style (complex) JavaScript code. Dojo's event systems, I/O APIs, and common language forms are based on a powerful programming environment.

4. Through the tools provided by dojo, you can write command line unit test code for your code.

5. The Dojo expansion pack makes your own code easier to maintain and less coupled.

Dojo accomplishes these functions with little code. When you write a script, you only need to include a few JS files, or you can choose to download the huge functionality provided by Dojo.

Version

Please download the Dojo 0.3.1, the following instructions are for this version

1: Add Dojo to our web program

1.1 Sign

<script type="text/javascript">
djConfig = { isDebug: false };
</script>

Djconfig is a global object in dojo that provides various options for dojo, Isdebug is one of the most commonly used properties, set to True so that you can see the debug output directly on the page, and of course some of the properties are related to debugging.

1.2 Boot code that references dojo

<script type= "Text/javascript" src= "/yourpath/dojo.js"/>

So you reference the dojo code, and you can directly use some of the commonly used objects, downloaded dojo.js is the compression (remove comments and space) after the code, to read, suggest reading Dojo.js.uncompressed.js, Dojo.js about 127K, and not compressed before there are 211K, OK, why so large, it has been part of the commonly used modules into the dojo.js, so it appears a bit larger, build.txt the default dojo.js contains what modules

1.3 Declare the bag you want to use

<script type="text/javascript">
dojo.require("dojo.math");
dojo.require("dojo.io.*");
dojo.require("dojo.widget.*");
</script>

You just think of the code as a Java import statement or a using statement in C #, and if you don't require, and the module itself is not integrated in Dojo.js, there's a script error.

2. Pre-integration packages for different needs

Dojo itself is made up of a number of modules, but because of the variety of user requirements, Dojo offers different versions for different requirements, and users can download dojo with a choice of many versions, such as Ajax and widget editions, The most important difference for each version is the Dojo.js file, but in addition, each version is fully functional, dojo.js is integrated into different modules according to the version.

3. Get the latest source code for dojo directly

......

Module

Dojo's code is divided into a logical unit called a module, which is somewhat similar to the package in Java, except that Dojo's modules can contain classes (similar to classes in Java) and simple functions

For example: the module "dojo.html" contains a series of functions, such as Dojo.html.getContentBox (), module "DOJO.DND" contains a series of htmldragobject classes

Note the name convention, the first letter of the function is a lowercase letter, the first letter of the class is uppercase

Modules can also be called "namespaces"

Package

In most cases, Dojo's modules only need to be defined in a file on it, but sometimes, a module may be divided into multiple files, such as: module dojo.html, originally defined in a file, but because of enhancements, the file gradually become larger, we have to split it into multiple files, This is primarily for performance reasons, so that browsers can download only the code they need, and unfortunately its implementation details don't seem so transparent to dojo users, you have to know which file you want to use, and then you can require and use it. Each of these files is called a package.

Resources:

1, http://dojotoolkit.org/

2, http://baike.baidu.com/view/1054672.htm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.