Skip to content

bodhi-realtime-agent / EventBus

Class: EventBus ​

Defined in: src/core/event-bus.ts:23

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: src/core/event-bus.ts:56

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: src/core/event-bus.ts:26

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: src/core/event-bus.ts:39

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