JEventDispatcher

Extends \JObject

Class to handle dispatching of events.

deprecated

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

see \JPlugin
since

3.0.0

deprecated

4.0 The CMS' Event classes will be replaced with the joomla/event package

package

Joomla.Platform

Methods

attach

Attach an observer object

attach(object $observer) : void
since

3.0.0

Arguments

$observer

objectAn observer object to attach

detach

Detach an observer object

detach(object $observer) : boolean
since

3.0.0

Arguments

$observer

objectAn observer object to detach.

Response

booleanTrue if the observer object was detached.

getInstance

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

getInstance() : \JEventDispatcher
static
since

3.0.0

Response

\JEventDispatcherThe EventDispatcher object.

getState

Get the state of the JEventDispatcher object

getState() : mixed
since

3.0.0

Response

mixedThe state of the object.

register

Registers an event handler to the event dispatcher

register(string $event, string $handler) : void
since

3.0.0

throws

\InvalidArgumentException

Arguments

$event

stringName of the event to register handler for

$handler

stringName of the event handler

trigger

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

trigger(string $event, array $args = array()) : array
since

3.0.0

Arguments

$event

stringThe event to trigger.

$args

arrayAn array of arguments.

Response

arrayAn array of results from each function call.

Properties

_observers

An array of Observer objects to notify

since

3.0.0

Type(s)

array

_state

The state of the observable object

since

3.0.0

Type(s)

mixed

_methods

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

since

3.0.0

Type(s)

array

instance

Stores the singleton instance of the dispatcher.

static
since

3.0.0

Type(s)

\JEventDispatcher