Working with Evented modules

The Evented module lets your widgets publish events. When your module is declared with Evented as the parent class, it provides an emit() method for broadcasting that the event has occurred, and an on() method for listening to events. One example that can be found in the ArcGIS API would be the drawing toolbar. It doesn't display information, but it has the tools necessary to publish events.

The emit() method takes two arguments. The first is a string name that describes the event, such as map-loaded or records-received. The second is an object created and passed along with the event. The object could be anything you can create in JavaScript, but remember to keep the returned content similar, so that the methods listening ...

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.