The JavaScript doing the actual work is the same in both the older style of modules with dojo.declare and the newer AMD style.
The big differences between legacy and AMD modules are how they are defined (dojo.declare()
vs. define()
) and how they are loaded (dojo.require()
vs. require()
).
legacy:
<script type="text/javascript"> dojo.require("esri.map"); function init() { var myMap = new esri.Map("mapDiv"); //note that if you do not have public Internet access then you will need to point this url to your own locally accesible cached service. var myTiledMapServiceLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://localhost:8399/rest/services/demo/MapServer"); myMap.addLayer(myTiledMapServiceLayer); } dojo.addOnLoad(init); </script>
AMD: