Class Event
This class describes script events that can be triggers and listened
Methods summary
public
|
#
__construct( string $name, array $data = array() )
Constructor. Create a new event
Constructor. Create a new event
Parameters
- $name
- The event name
- $data
- The event initial data
|
public
string
|
#
getName( )
Get the event name
Returns
string The event name
|
public
mixed
|
#
getData( string $prop = null )
Get event data. This method is used to get all the data of the event, or a specific data property
Get event data. This method is used to get all the data of the event, or a specific data property
Parameters
- $prop
- If set, this method will return the data property, else return all the event data
Returns
mixed The event data
|
public
|
#
setData( string $prop, mixed $value )
Set data to the event
Parameters
- $prop
- The property name to set in the data
- $value
- The value to set
|
public static
|
#
on( string $name, callable $action, integer $order = self::ORDER_LAST )
Add a listener on a event type
Add a listener on a event type
Parameters
- $name
- The event name
- $action
- The action to perform when the event is triggered. This function take as argument the event itself
- $order
- The listener order. If set, all the listeners on the same event type are executed following their order
|
public static
|
#
unbind( string $name )
Remove all listeners on a event type
Remove all listeners on a event type
Parameters
|
public
|
|