The modular front-end entry

1, the front end modular learned: freezing cold from "writing maintainable JavaScript-3" books learned the concept of modularity and AMD module, but do not understand.

2, Reference: https: //blog.csdn.net/qq_35697034/article/details/78297756 finally understand what is the concept of ADM module:

Mention of modular, often comes CommonJS and AMD. Maybe the main thing is what it, remember that it is modular, standards can be. The RequireJS is the best realization of AMD specification. Like the relationship between ECMAScript and JavaScript is that the former is the latter specification, which is an implementation of the former. We just need to know to achieve CommonJS standardized API is synchronous load modules, and achieve API AMD specification is module is loaded asynchronously, asynchronous non-blocking load that is loaded, more suitable for the browser. The official description of the document's RequireJS:

RequireJS is a JavaScript module loader. It is ideal for use in the browser, but it can also be used in other scripting environment, like Rhino and Node. RequireJS loaded using a modular script will load faster and the quality of the code.

3, made a sample: Reference: https: //www.jb51.net/article/119496.htm, but did not run successfully.

4, does not intend to modular programming, because do not realize the need to use. The first single-use global variables.

Guess you like

Origin www.cnblogs.com/lirenhe/p/11568374.html