Chapter 7. Advanced techniques

 

This chapter covers

  • Building an application from a JSON configuration
  • Writing a loader class to handle widget loading
  • Treating new functionality as a new widget
  • Taking advantage of the web map specification
  • Implementing advanced offline functionality

By now you have a fairly good grasp of the basics of the ArcGIS API for JavaScript. You’ve seen how custom widgets are built, and you’ve loaded default widgets and used them in your applications. You should also have a well-rounded idea of how the Dojo Toolkit is used to build applications using the ArcGIS API for JavaScript. Believe it or not, I’ve intentionally kept things straightforward and tried to prevent showing overly complicated examples that detract from the core of the tasks at hand.

In this chapter we cover a few advanced techniques that I’ve found useful over the years. They help focus development on the purpose of the application so you don’t have to worry about too much boilerplate code. Many of these techniques involve using basic patterns of the ArcGIS JavaScript API that you may find while building applications. A couple of these techniques take advantage of lesser-discussed tools built into the ArcGIS API for JavaScript, such as how it can build a map from a simple WebMap ID from ArcGIS Online. This allows you to use specifications of the ArcGIS REST API to your advantage. I also cover more advanced techniques for working with the application when an internet connection is lost.

7.1. Using a single configuration file

7.2. Dynamic widget loading

7.3. Adding a web map

7.4. Advanced techniques for offline mode

7.5. Summary