mini_arcade_core.bus

Event bus module.

Attributes

Classes

EventBus

Simple event bus for managing event subscriptions and emissions.

Module Contents

class mini_arcade_core.bus.EventBus

Simple event bus for managing event subscriptions and emissions.

on(event_type: str, handler: Callable)

Subscribe a handler to an event type.

Parameters:
  • event_type (str) – The type of event to subscribe to.

  • handler (Callable) – The handler function to call when the event is emitted.

emit(event_type: str, **kwargs)

Emit an event of a given type, calling all subscribed handlers.

Parameters:
  • event_type (str) – The type of event to emit.

  • kwargs – Additional keyword arguments to pass to handlers.

clear()

Clear all subscribers from the event bus.

mini_arcade_core.bus.event_bus