Public Member Functions | Protected Attributes

BeCallbackManager Class Reference

Basic event manager for BEdita. More...

List of all members.

Public Member Functions

 bind ($eventName, $listener)
 Attaches a listener to an event.
 unbind ($eventName=null, $listener=null)
 Detaches a listener from an event.
 trigger ($eventName, array $eventData=array())
 Triggers a new event, calling all listeners binded to that event in the order they were added.

Protected Attributes

 $listeners = array()

Detailed Description

Basic event manager for BEdita.

Definition at line 25 of file be_callback_manager.php.


Member Function Documentation

BeCallbackManager::bind ( eventName,
listener 
)

Attaches a listener to an event.

Listeners can be either anonymous functions or pairs of class name / method name (`ClassRegistryinit()` will be used in this case to retreive object instance).

See also:
ClassRegistry::init()
Parameters:
string $eventName Name of the event to be listened.
mixed $listener Callback or full qualified name of listener.
Returns:
boolean Success. public

Definition at line 47 of file be_callback_manager.php.

BeCallbackManager::trigger ( eventName,
array $  eventData = array() 
)

Triggers a new event, calling all listeners binded to that event in the order they were added.

Passing data as an array will result in callbacks associated to the triggered event being called with array elements as arguments in the order they appear in that array (as of `call_user_func_array()`). In addition to that, the `$event` object will be passed to those callbacks as *last* argument, thus allowing listeners to gain control on event propagation or modifying the event itself.

Parameters:
string $eventName Name of the event to be triggered.
array $eventData Data of the event.
Returns:
stdClass Class representing the event triggered, with `name`, `data`, `result` and `stopped` keys. public

Definition at line 128 of file be_callback_manager.php.

BeCallbackManager::unbind ( eventName = null,
listener = null 
)

Detaches a listener from an event.

If `$eventName` is `null`, the given `$listener` will be detached from any event it was attached to. If `$listener` is `null`, all listeners binded to the given `$eventName` will be detached from that event. If both parameters are empty, each end every listener is cleared from any event.

Parameters:
string $eventName Name of the event to be unbinded.
mixed $listener Callback or full qualified name of callback.
Returns:
boolean Success. public

Definition at line 68 of file be_callback_manager.php.


The documentation for this class was generated from the following file:
Generated on Fri Dec 11 2015 15:29:46 by Doxygen 1.7.1  BEditaBEdita 3.7 Corylus