JDispatcher
Extends \JEventDispatcherDeprecated class placeholder. You should use JEventDispatcher instead.
This is the Observable part of the Observer design pattern for the event architecture.
since |
1.5 |
---|---|
deprecated |
3.0 |
package |
Joomla.Legacy |
Methods
__construct
Constructor.
__construct()
since |
1.5 |
---|
attach
Attach an observer object
attach(object $observer) : void
since |
3.0.0 |
---|
Arguments
- $observer
object
An observer object to attach
detach
Detach an observer object
detach(object $observer) : boolean
since |
3.0.0 |
---|
Arguments
- $observer
object
An observer object to detach.
Response
boolean
True if the observer object was detached.
getInstance
Returns the global Event Dispatcher object, only creating it if it doesn't already exist.
getInstance() : \JEventDispatcher
getState
Get the state of the JEventDispatcher object
getState() : mixed
since |
3.0.0 |
---|
Response
mixed
The state of the object.
register
Registers an event handler to the event dispatcher
register(string $event, string $handler) : void
since |
3.0.0 |
---|---|
throws |
|
Arguments
- $event
string
Name of the event to register handler for- $handler
string
Name 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
string
The event to trigger.- $args
array
An array of arguments.
Response
array
An 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.