EventEmitter
trait EventEmitter
Adds event related features to any class.
Properties
protected array | $emitterSingleEvents | ||
protected array | $emitterEvents | ||
protected array | $emitterEventSorted |
Methods
Create a new event binding.
Create a new event binding that fires once only
Sort the listeners for a given event by priority.
Destroys an event binding.
Fire an event and call the listeners.
Fires a combination of local and global events. The first segment is removed from the event name locally and the local object is passed as the first argument to the event globally. Halting is also enabled by default.
Details
at line 36
EventEmitter
bindEvent(string $event, callable $callback, int $priority = 0)
Create a new event binding.
at line 52
EventEmitter
bindEventOnce(string $event, callable $callback)
Create a new event binding that fires once only
at line 66
protected void
emitterEventSortEvents(string $eventName)
Sort the listeners for a given event by priority.
at line 84
EventEmitter
unbindEvent(string $event = null)
Destroys an event binding.
at line 124
string|array
fireEvent(string $event, array $params = [], bool $halt = false)
Fire an event and call the listeners.
at line 178
mixed
fireSystemEvent(string $event, array $params = [], bool $halt = true)
Fires a combination of local and global events. The first segment is removed from the event name locally and the local object is passed as the first argument to the event globally. Halting is also enabled by default.
For example:
$this->fireSystemEvent('admin.form.myEvent', ['my value']);
Is equivalent to:
$this->fireEvent('form.myEvent', ['myvalue'], true);
Event::fire('admin.form.myEvent', [$this, 'myvalue'], true);