Although the sparrow is a little dirty, the Dojo custom control application (1)

Source: Internet
Author: User
Tags mootools

Currently, there are many Javascript frameworks and control libraries, such as jQuery, Ext, prototype, MooTools, and Dojo. These are all listed on the first page of Google's search for "javascript + framework. Among them, except for MooTools, all others have some knowledge, but only Ext and Dojo are used in the project. However, I have never liked Ext very much, and the performance is faulty. I still pay for the new version.

In addition, the official examples provided by Ext are to use JavaScript to create and initialize controls. A JavaScript file is used with an HTML file, which makes management messy. In addition, the official example is Best Practice, so this mode is not acceptable. In my opinion, Dojo is a guy with outstanding shortcomings and advantages:

Disadvantages:

1. Very poor documentation;

2. What are the major advantages and disadvantages of CodeBase ?);

3. Version evolution is fast, and each version evolution has a large number of API changes, which are not mature enough.

Advantages:

1. It is a very good control development framework;

2. fully embodies the object-oriented aspect of javascript.

Comparing EXT with Dojo, I think EXT is a control library, while Dojo is a framework. The first time I came into contact with Dojo, the version 0.3.X at that time. Now I want to use Dojo in the project. The version is 1.3.1. Compared with 0.3 and 1.3, I found that the core idea has not changed much, however, the controls provided by the factory have undergone dramatic changes, but they are already preemptible to their own controls. As a result, they are not interested in studying them now, let's talk about how to use Dojo for custom controls. Dojo is complex, but we can simply think of it as three layers:

1. Core APIs

The core API provides methods to simplify DOM, String, CSS, and event-related operations. The core API also implements the package concept and import mechanism similar to Java, facilitating Code Organization and dependency management.

2. The core API creates the concept of "control lifecycle ".

This is the highlight of Dojo and allows third parties to develop controls in a standardized manner. Widgets developed based on Dojo have strong cohesion and object-oriented features.

3. Various controls developed based on 2

The controls provided by Dojo are also comprehensive, but they have not been thoroughly studied for historical reasons.

Dojo controls are collectively referred to as DIJIT. To write a Hello World Control for the Dojo version, you need to know little about it:

◆ A control is a JS class;

◆ All controls inherit from _ widgets or their subclasses. _ widgets provide the control lifecycle management functions;

◆ It can inherit the _ Templated class at the same time and bind a template to the control to describe the display of the control.


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.