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

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.

主站蜘蛛池模板: 闵行区| 工布江达县| 潜江市| 大庆市| 长寿区| 靖西县| 东方市| 龙川县| 黄梅县| 安岳县| 西林县| 宿迁市| 嘉峪关市| 南江县| 贵溪市| 新巴尔虎右旗| 鹤峰县| 贞丰县| 濮阳市| 原平市| 宜州市| 鹿泉市| 乐陵市| 鞍山市| 漯河市| 云安县| 和田县| 兴城市| 武宣县| 石屏县| 宝清县| 汉寿县| 延津县| 兖州市| 玉龙| 徐水县| 晋城| 建德市| 天镇县| 瓦房店市| 马边|