Relive AMD, CMD

Source: Internet
Author: User
Tags define function

The AMD specification originates from the TRANSPORT/C specification in Commonjs, in the following format:

Define (ID?, dependencies, Factory);

Module Name specification:

1. Module name consists of: multiple string name or '/';

2. String name follows the hump rule, or: '. ', '. ' ;

3. Module name is forbidden with extension, such as: '. js ';

4. Top-level Path module name starts with the root space, relative path module name: With '. ', '. ' Start

Dependency specification:

1. If it is ["require", "exports", "module"], follow the COMMONJS specification, otherwise inject the parameter as a parameter list in factory.

Factory Specification:

1. No dependent parameters, through ToString to require dependence, dependent parameters are accessed by dependent parameters;

2. Reliance on first execution, factory execution;

Define.amd Property

1. AMD attributes identify that the Define function complies with the AMD specification to distinguish it from non-compliance with AMD's define functions;

2. If the AMD specification is updated, the AMD2 attribute will be the name;

3. The value of the AMD attribute is an object, but the object specific content has the implementation of the customization;

Relationship with Commonjs:

1. As long as the COMMONJS (NodeJS) factory in the absence of synchronized require can be common, because the browser side is not supported, but also the performance impact.

Relive AMD, CMD

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.