Event
class Event (View source)
Constants
| HIGH_PRIORITY |
|
| LOW_PRIORITY |
|
| TRIGGER_UNDEFINED |
|
| TRIGGER_CONSUMED |
|
| TRIGGER_STOPPED |
|
| TRIGGER_SUCCESS |
|
Methods
Triggers all callbacks registered for a given event
Registers a callback to an event with optional priority. Note: If any subscribed callback returns a boolean false, further execution of subsequent callbacks will be halted
It makes a type of event unique, ensuring that all registered events of that type are triggered only once.
Removes a specific callback or all callbacks registered for an event.
Clears all registered events and uniqueness flags
Details
static int
trigger(string $name, array $args = array())
Triggers all callbacks registered for a given event
static
on(string $name, callable $callback, int $priority = 0)
Registers a callback to an event with optional priority. Note: If any subscribed callback returns a boolean false, further execution of subsequent callbacks will be halted
static
once(string $name)
It makes a type of event unique, ensuring that all registered events of that type are triggered only once.
static
off(string $name, callable|null $callback = null)
Removes a specific callback or all callbacks registered for an event.
If $callback is null, all listeners for the given event are removed.
static
clear()
Clears all registered events and uniqueness flags