events¶
- class litestar.events.BaseEventEmitterBackend[原始碼]¶
基底類別:
AbstractAsyncContextManager[BaseEventEmitterBackend],ABCAbstract class used to define event emitter backends.
- __init__(listeners: Sequence[EventListener]) None[原始碼]¶
Create an event emitter instance.
- 參數:
listeners¶ -- A list of listeners.
- class litestar.events.EventListener[原始碼]¶
基底類別:
objectDecorator for event listeners
- __call__(fn: AnyCallable) EventListener[原始碼]¶
Decorate a callable by wrapping it inside an instance of EventListener.
- 參數:
fn¶ -- Callable to decorate.
- 回傳:
An instance of EventListener
- __init__(*event_ids: str) None[原始碼]¶
Create a decorator for event handlers.
- 參數:
*event_ids¶ -- The id of the event to listen to or a list of event ids to listen to.
- static wrap_in_error_handler(fn: AsyncAnyCallable) AsyncAnyCallable[原始碼]¶
Wrap a listener function to handle errors.
Listeners are executed concurrently in a TaskGroup, so we need to ensure that exceptions do not propagate to the task group which results in any other unfinished listeners to be cancelled, and the receive stream to be closed.
See https://github.com/litestar-org/litestar/issues/2809
- 參數:
fn¶ -- The listener function to wrap.
- class litestar.events.SimpleEventEmitter[原始碼]¶
-
Event emitter the works only in the current process
- __init__(listeners: Sequence[EventListener]) None[原始碼]¶
Create an event emitter instance.
- 參數:
listeners¶ -- A list of listeners.
- litestar.events.listener¶
EventListener的別名