Namespace: adways.event

Contains base definitions for event handling.

principes

  1. Some "listener" functions are attached to a "dispatcher" for a particular "event".
  2. Something happens to the dispatcher that should be notified to other objects.
  3. So the dispatcher dispatches an event.
  4. All the listeners attached to the dispatcher for this event are called during the dispatching operation.
  5. These listeners should execute the right operations so that the objects they belong to react correctly.
It is a system close to "callback", but more powerful since it allows multiple listeners.

listener
A listener is a function:
function myListener (e:adways.event.IEventR) { ... }


dispatcher
A dispatcher is an object on which one listeners can be added. It is responsible of maintaining the map that make the listeners corresponding to a particular "kind" of information. It is also responsible of calling those listeners when it dispatches an event of the corresponding kind.
see {@link adways.event.IEventDispatcherR}

event
An event is an object "thrown/fired/dispatched" by another one to "broadcastly" inform for something. As an exemple, when the value of a number changes, the number may dispatch a "VALUE_CHANGED" event, so that all the objects interested in this number's value can react according to the new value (note: here, "VALUE_CHANGED" is the event's kind).
see {@link adways.event.IEventR}

kind
The kind is a constant that conceptually identifies the information carried up by the event. It allows the association "event <-> listeners" done by the dispatcher.