Skip to main content

EventManager

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 emitting PersistState events at regular intervals.

Hierarchy

Index

Methods

__aenter__

  • Initialize the event manager upon entering the async context.


    Returns EventManager

__aexit__

  • async __aexit__(exc_type, exc_value, exc_traceback): None
  • 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__

  • __init__(*, persist_state_interval, close_timeout): None
  • Initialize a new instance.


    Parameters

    • optionalkeyword-onlypersist_state_interval: timedelta = timedelta(minutes=1)

      Interval between emitted PersistState events to maintain state persistence.

    • optionalkeyword-onlyclose_timeout: timedelta | None = None

      Optional timeout for canceling pending event listeners if they exceed this duration.

    Returns None

:

:

:

:

Properties

active

active: bool

Indicate whether the context is active.

Page Options