First of all, the value of the front-end modularity: The reference module is described here in detail and can be viewed on its own.
A. Summarize the following advantages:
(1) Resolving naming conflicts
(2) Cumbersome file dependencies
(3) version management of the module
(4) Improved maintainability
(5) Front-end performance optimization
(6) Cross-environment sharing module
Two. The basic idea of the loader:
How do we define our modules?
How do we merge the modules we define?
We think about, if we normal reference into the JS page we need to do God horse things, whether it is used: <script type= "text/javascript" src= "xxx" ></SCRIPT> then the question came, In fact, the thing we need to do is to dynamically construct the <script>, is it possible for the loader to implement this function?
In fact, this time we look at the above <script Src> Do we still need to know the address of our config JS file? This can be correctly introduced JS?
Here we are due to how to configure the address function ()
Did we mention that we solved the dependencies between modules? Well, we should know that since we are going to implement the dependencies between modules, we definitely need to know if the JS we rely on is already loaded. Here we need to realize whether JS loading complete function?
JS Front-end Modular loader principle Analysis (I.)