TuiEventBusInterface
A synchronous publish/subscribe bus for {@see TuiEvent}s, decoupling event sources (e.g. {@see BackgroundJobManagerInterface} transitions) from whatever reacts to them (e.g. a job-monitor node renderer) without either depending on the other directly.
TuiEventBusInterface::subscribe()
abstract public function subscribe(string $eventType, callable $listener): voidRegisters a listener for events of `$eventType`. The type `'*'` is a wildcard: implementations MUST invoke a `'*'` listener for every published event, regardless of its own type.
Parameters
| Name | Type | Description |
|---|---|---|
| $eventType | string | |
| $listener | callable(TuiEvent): void |
TuiEventBusInterface::publish()
abstract public function publish(Milpa\Live\ValueObjects\Tui\TuiEvent $event): voidPublishes an event: appends it to {@see history()} and synchronously invokes every listener subscribed to its exact type plus every `'*'`-subscribed listener.
Parameters
| Name | Type | Description |
|---|---|---|
| $event | Milpa\Live\ValueObjects\Tui\TuiEvent |
TuiEventBusInterface::history()
abstract public function history(): arrayThe full log of events published so far, in publish order.