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 for the event to occur don't miss it.