Book Image

Mastering ArcGIS Server Development with JavaScript

By : Raymond Kenneth Doman
Book Image

Mastering ArcGIS Server Development with JavaScript

By: Raymond Kenneth Doman

Overview of this book

Table of Contents (18 chapters)
Mastering ArcGIS Server Development with JavaScript
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

The event system


The event system within JavaScript is an important part of the language. JavaScript was designed to respond to events in the browser and events caused by users. A website may need to respond to the click of a user, or an AJAX response from a server. With the language, you can attach functions called event handlers to listen for events from certain elements in the page and the browser.

In the Dojo framework, events are listened to using the dojo/on module. When assigning an event listener, the module function call returns an object that lets you discontinue listening by calling the object's remove() method. Also, dojo/on has a once() method that fires the event once, when the event occurs, then automatically removes the event.

Tip

Some older ArcGIS API samples still use Dojo's old event handler, dojo.connect(). Events handlers would be attached with dojo.connect(), and removed with dojo.disconnect(). The Dojo Foundation is currently depreciating dojo.connect(), and will drop...