Loading required modules

To take advantage of the Dojo's AMD style, we're going to use Dojo's require function. In older examples, we would create multiple dojo.require("") statements that would load the parts of the ArcGIS JavaScript library we needed (and hopefully by the time we wanted to use them). But with AMD style, we use a single require function that requests the list of libraries we ask for, and loads them within a function that runs after all the libraries are loaded in the browser:

  <div id="map"></div>
  <script type="text/javascript">
    require([], function () {});
  </script>
</body>

The require function takes two arguments, an array of strings that corresponds to folder locations in our library, and a function that runs after those libraries ...

Get Mastering ArcGIS Server Development with JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.