EventManager
Hierarchy
- EventManager
Index
Methods
__aenter__
- Initialize the event manager upon entering the async context. - Returns EventManager
__aexit__
- Close the local event manager upon exiting the async context. - This will stop listening for the events, and it will wait for all the event listeners to finish. - Parameters- exc_type: type[BaseException] | None
- exc_value: BaseException | None
- exc_traceback: TracebackType | None
 - Returns None
__init__
- Initialize a new instance. - Parameters- optionalkeyword-onlypersist_state_interval: timedelta = timedelta(minutes=1)- Interval between emitted - PersistStateevents to maintain state persistence.
- optionalkeyword-onlyclose_timeout: timedelta | None = None- Optional timeout for canceling pending event listeners if they exceed this duration. 
 - Returns None
emit
off
- Remove a specific listener or all listeners for an event. - Parameters- keyword-onlyevent: Event- The Actor event for which to remove listeners. 
- optionalkeyword-onlylistener: EventListener[Any] | None = None- The listener which is supposed to be removed. If not passed, all listeners of this event are removed. 
 - Returns None
on
- Register an event listener for a specific event. - Parameters- keyword-onlyevent: Event- The event for which to listen to. 
- keyword-onlylistener: EventListener[Any]- The function (sync or async) which is to be called when the event is emitted. 
 - Returns None
wait_for_all_listeners_to_complete
- Wait for all currently executing event listeners to complete. - Parameters- optionalkeyword-onlytimeout: timedelta | None = None- The maximum time to wait for the event listeners to finish. If they do not complete within the specified timeout, they will be canceled. 
 - Returns None
Properties
active
Indicate whether the context is active.
Manage events and their listeners, enabling registration, emission, and execution control.
It allows for registering event listeners, emitting events, and ensuring all listeners complete their execution. Built on top of
pyee.asyncio.AsyncIOEventEmitter. It implements additional features such as waiting for all listeners to complete and emittingPersistStateevents at regular intervals.