====== JEventDispatcher [Review] ====== {#JAPI Joomla.Framework Event JEventDispatcher #} Class to handle dispatching [[JEventDispatcher/#Events|events]]. ===== Methods ===== ^ Method ^ Description ^ | {{references:Constructor.png?nolink}} [[JEventDispatcher-__construct|__construct]] | Constructor | | {{references:Method.png?nolink}} [[JEventDispatcher-getInstance|getInstance]] | Returns a reference to the global Event Dispatcher object, only creating it if it doesn't already exist. | | {{references:Method.png?nolink}} [[JEventDispatcher-register|register]] | Registers an event handler to the event dispatcher | | {{references:Method.png?nolink}} [[JEventDispatcher-trigger|trigger]] | Triggers an event by dispatching arguments to all observers that handle the event and returning their return values. | ==== Events ==== An event represents the non-UI side of a command which are [[JEventDispatcher-register|registered]] with the Event Dispatcher by the application or an extension. The name of the event to be registered can be freely choosen at design time, but is typically named **on** followed by the name of some action being performed or a status set by the [[references:joomla.framework:Abstract:JObservable|Observable]] object. The Observable furnishes the context where its events occur and configures the Dispatcher with data from properties declared by the action and to inform all Observers. When the Observable [[JEventDispatcher-trigger|triggers]] the events during its life-cycle, the Observer's [[references:joomla.framework:Abstract:JObserver-update|update()]] method is invoked to do the real work. ---- ~~DISCUSSION~~