betty.event_dispatcher module - Betty documentation

Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
View this page
Toggle table of contents sidebar

# betty.event_dispatcher module

Provide the Dispatch API.

class betty.event_dispatcher.Event

  Bases: `object`

  An event that can be dispatched and handled.

  For each unique ‘conceptual’ event (a thing that happens while using Betty), a subclass MUST be created for that specific event type. Instances of these subclasses are dispatched and handled.

final class betty.event_dispatcher.EventDispatcher

  Bases: `_EventHandlerRegistry`

  Dispatch events to event handlers.

  async dispatch(event: Event) → None

    Dispatch an event.

final class betty.event_dispatcher.EventHandlerRegistry

  Bases: `_EventHandlerRegistry`

  Manage event handlers.

  property handlers: Mapping[type[Event], Sequence[Sequence[EventHandler[Event]]]]

    The registered event handlers.