官术网_书友最值得收藏!

Asynchronous Module Definition

Both the ArcGIS JavaScript API and Dojo decided to handle the bloated library crisis by incorporating the concept of Asynchronous Module Definition (AMD). In AMD, a library is broken down into modular components. The developer can pick and choose which parts of library they want to include in the application. By loading only the parts we need, we reduce download times, free the browser memory of unused functionality, and improve performance.

Another advantage of AMD is name collision avoidance or the names of the variables where the libraries load are controlled by the developer. Also, the scope of the loaded libraries is limited to within the calling function, much like a self-executing statement.

In an AMD based application, we make a list of the library modules we want to use, usually in an array of strings that the library knows how to interpret. We then follow it up with a function that loads most or all of those modules into JavaScript objects. We can then use those modules within the function to get the results we want.

主站蜘蛛池模板: 栾川县| 仙桃市| 黔江区| 象山县| 石屏县| 南和县| 邵东县| 渝中区| 邳州市| 蓬安县| 万年县| 绥阳县| 香格里拉县| 肇源县| 濮阳县| 陆川县| 重庆市| 阿尔山市| 浦东新区| 赤城县| 临泽县| 于都县| 琼结县| 临汾市| 湛江市| 孙吴县| 晋江市| 班戈县| 静宁县| 皋兰县| 隆尧县| 寻乌县| 菏泽市| 蕲春县| 萨嘎县| 呼图壁县| 桃园市| 若羌县| 甘洛县| 武冈市| 施甸县|