Events API¶
events
¶
Core components for the library's event-driven architecture.
Event
dataclass
¶
Encapsulate system event data.
EventEmitter
¶
Manage event subscriptions and dispatching.
emit
async
¶
Dispatch an event to registered listeners.
emit_nowait
¶
emit_nowait(*, event_type: EventType | str, data: EventData | None = None, source: Any = None) -> None
Schedule an event dispatch without awaiting.
get_event_history
¶
Retrieve the recorded event history.
listener_count
¶
Return the number of listeners for an event.
listeners
¶
Return the list of handlers for an event.
off
¶
Unregister specific or all handlers for an event.
on
¶
Register a persistent event handler.
once
¶
Register a one-time event handler.
remove_all_listeners
¶
Clear listeners for a specific or all events.
set_max_listeners
¶
Update the maximum listener limit.
wait_for
async
¶
wait_for(*, event_type: EventType | str | list[EventType | str], condition: Callable[[Event], bool] | None = None, timeout: float | None = None) -> Event
Await the emission of a specific event.