This is some of the information collected online and some of your own views about AMD and CMD
AMD specifications are here:https://github.com/amdjs/amdjs-api/wiki/amd
The CMD specification is here:https://github.com/seajs/seajs/issues/242
AMD is the normalized output of the module defined by REQUIREJS during the promotion process.
CMD is the normalized output of the module defined by SEAJS in the process of generalization.
Similar to the CommonJS modules/2.0 specification, is bravojs in the promotion process of the module definition of standardized output.
A lot more??
These specifications are intended for the modular development of JavaScript, especially on the browser side.
At present, the implementation of these specifications can achieve the purpose of browser-side modular development.
Difference:
1. For dependent modules, AMD is executed in advance and CMD is deferred. However, starting from 2.0, Requirejs is also changed to be deferred (depending on the way it is written and handled differently). CMD respected as lazy as possible.
2. CMD is highly dependent on the nearest, AMD is highly dependent on the predecessor. :
Cmd
Define (function (Require, exports, module) {
var a = require ('./a ')
A.dosomething ()
100 lines are omitted here
var B = require ('./b ')//dependency can be written near
B.dosomething ()
// ...
})
The default recommended by AMD is
define (['./a ', './b '), function (A, B) {//dependencies must be written at the beginning.
A.dosomething ()
100 lines are omitted here
B.dosomething ()
...
})
While AMD supports the syntax of CMD, it also supports passing require as a dependency, but Requirejs's author defaults to the preferred notation, which is the default definition of the module in the official document.
3. AMD's API defaults to one when multiple uses, the CMD API is strictly differentiated, advocating a single responsibility. For example, AMD, require global require and local require, are called require. In CMD, there is no global require, but according to the completeness of the module system, provide seajs.use to realize the loading and starting of the module system. CMD, each API is simple and pure.
AMD and CMD