EventEmitterTrait
trait EventEmitterTrait
Our Event Emitter Trait.
Properties
protected array | $listeners | ||
protected array | $onceListeners |
Methods
$this
on(string $event, callable $listener)
Attach a listener to an event.
$this
once(string $event, callable $listener)
Attach a listener to an event, for exactly once.
$this
removeListener(string $event, callable $listener)
Remove specified listener from an event.
$this
removeAllListeners(string|null $event = null)
Remove all listeners from an event (or all listeners).
array
listeners(string|null $event = null)
Get listeners for a specific events, or all listeners.
void
emit(string $event, mixed ...$arguments)
Emits an event, catching all exceptions and emitting an error event for these exceptions.
Details
at line 34
$this
on(string $event, callable $listener)
Attach a listener to an event.
at line 50
$this
once(string $event, callable $listener)
Attach a listener to an event, for exactly once.
at line 66
$this
removeListener(string $event, callable $listener)
Remove specified listener from an event.
at line 95
$this
removeAllListeners(string|null $event = null)
Remove all listeners from an event (or all listeners).
at line 116
array
listeners(string|null $event = null)
Get listeners for a specific events, or all listeners.
at line 143
void
emit(string $event, mixed ...$arguments)
Emits an event, catching all exceptions and emitting an error event for these exceptions.