Class JDispatcher

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
   |
   --JDispatcher
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 JDispatcher $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 method 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 JDispatcher getInstance ()
attach (line 186)

Attach an observer object

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

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 JDispatcher object

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

Registers an event handler to the event dispatcher

  • since: 11.1
  • 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 129)

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()
JObject::__toString()

Documentation generated on Mon, 25 Jun 2012 13:54:17 -0500 by phpDocumentor 1.4.4