EventDispatcher
class EventDispatcher implements Dispatcher
No-op fallback dispatcher used by ServerFactory when no real dispatcher is set.
Methods
Register an event listener with the dispatcher.
Register a passive event observer.
Determine if a given event has listeners.
Register an event subscriber with the dispatcher.
Dispatch an event until the first non-null response is returned.
Dispatch an event and call the listeners.
Register an event and payload to be fired later.
Flush a set of pushed events.
Remove a set of listeners from the dispatcher.
Forget all events queued via push() in the current coroutine.
Details
at line 16
void
listen(array|Closure|QueuedClosure|string $events, array|object|string|null $listener = null)
Register an event listener with the dispatcher.
at line 20
void
observe(array|string $events, array|object|string $observer)
Register a passive event observer.
Observers receive dispatched events but are not counted by hasListeners().
at line 24
bool
hasListeners(string $eventName)
Determine if a given event has listeners.
at line 29
void
subscribe(object|string $subscriber)
Register an event subscriber with the dispatcher.
at line 33
mixed
until(object|string $event, mixed $payload = [])
Dispatch an event until the first non-null response is returned.
at line 38
mixed
dispatch(object|string $event, mixed $payload = [], bool $halt = false)
Dispatch an event and call the listeners.
at line 43
void
push(string $event, mixed $payload = [])
Register an event and payload to be fired later.
at line 47
void
flush(string $event)
Flush a set of pushed events.
at line 51
void
forget(string $event)
Remove a set of listeners from the dispatcher.
at line 55
void
forgetPushed()
Forget all events queued via push() in the current coroutine.