Skip to content

bodhi-realtime-agent / EventBus

Class: EventBus

Defined in: core/event-bus.ts:25

In-memory, synchronous event bus. Handler exceptions are caught and logged — they never propagate to the publisher.

Implements

Constructors

Constructor

new EventBus(): EventBus

Returns

EventBus

Methods

clear()

clear(): void

Defined in: core/event-bus.ts:58

Remove all handlers (used for cleanup in tests and session teardown).

Returns

void

Implementation of

IEventBus.clear


publish()

publish<T>(event, payload): void

Defined in: core/event-bus.ts:28

Synchronously dispatch an event to all registered handlers.

Type Parameters

T

T extends keyof EventPayloadMap

Parameters

event

T

payload

EventPayloadMap[T]

Returns

void

Implementation of

IEventBus.publish


subscribe()

subscribe<T>(event, handler): Unsubscribe

Defined in: core/event-bus.ts:41

Register a handler for an event type. Returns an unsubscribe function.

Type Parameters

T

T extends keyof EventPayloadMap

Parameters

event

T

handler

EventHandler<T>

Returns

Unsubscribe

Implementation of

IEventBus.subscribe

Built with VitePress