Class JEventDispatcher

Description

Class to handle dispatching of events.

This is the Observable part of the Observer design pattern for the event architecture.

Located in /libraries/joomla/event/dispatcher.php (line 24)

JObject
   |
   --JEventDispatcher
Direct descendents
Class Description
 class JDispatcher Deprecated class placeholder. You should use JEventDispatcher instead.
Variable Summary
Method Summary
 void attach (object $observer)
 boolean detach (object $observer)
 mixed getState ()
 void register (string $event, string $handler)
 array trigger (string $event, [array $args = array()])
Variables
static JEventDispatcher $instance = null (line 56)

Stores the singleton instance of the dispatcher.

  • since: 11.3
  • access: protected
array $_methods = array() (line 48)

A multi dimensional array of [function][] = key for observers

  • since: 11.3
  • access: protected
array $_observers = array() (line 32)

An array of Observer objects to notify

  • since: 11.3
  • access: protected
mixed $_state = null (line 40)

The state of the observable object

  • since: 11.3
  • access: protected

Inherited Variables

Inherited from JObject

JObject::$_errors
Methods
static getInstance (line 66)

Returns the global Event Dispatcher object, only creating it if it doesn't already exist.

  • return: The EventDispatcher object.
  • since: 11.1
  • access: public
static JEventDispatcher getInstance ()
attach (line 188)

Attach an observer object

  • since: 11.3
  • access: public
void attach (object $observer)
  • object $observer: An observer object to attach
detach (line 256)

Detach an observer object

  • return: True if the observer object was detached.
  • since: 11.3
  • access: public
boolean detach (object $observer)
  • object $observer: An observer object to detach.
getState (line 83)

Get the state of the JEventDispatcher object

  • return: The state of the object.
  • since: 11.3
  • access: public
mixed getState ()
register (line 99)

Registers an event handler to the event dispatcher

  • since: 11.1
  • throws: InvalidArgumentException
  • access: public
void register (string $event, string $handler)
  • string $event: Name of the event to register handler for
  • string $handler: Name of the event handler
trigger (line 130)

Triggers an event by dispatching arguments to all observers that handle the event and returning their return values.

  • return: An array of results from each function call.
  • since: 11.1
  • access: public
array trigger (string $event, [array $args = array()])
  • string $event: The event to trigger.
  • array $args: An array of arguments.

Inherited Methods

Inherited From JObject

 JObject::__construct()
 JObject::def()
 JObject::get()
 JObject::getError()
 JObject::getErrors()
 JObject::getProperties()
 JObject::set()
 JObject::setError()
 JObject::setProperties()
 JObject::__toString()

Documentation generated on Tue, 19 Nov 2013 15:01:31 +0100 by phpDocumentor 1.4.3