Skip to content

kernel/events/event-bus

Defined in: app/src/kernel/events/event-bus.ts:34

Publishes typed application events between modules that do not know each other. A failing listener is reported to the error handler and does not stop the others.

new EventBus(onError): EventBus

Defined in: app/src/kernel/events/event-bus.ts:39

EventErrorHandler

Receives errors thrown by listeners.

EventBus

dispose(): void

Defined in: app/src/kernel/events/event-bus.ts:76

Removes all subscriptions.

void

Disposable.dispose

emit<T>(type, payload): void

Defined in: app/src/kernel/events/event-bus.ts:71

Delivers an event to all current subscribers.

T

EventType<T>

The event type.

T

The payload.

void

on<T>(type, listener): Disposable

Defined in: app/src/kernel/events/event-bus.ts:49

Subscribes to an event type.

T

EventType<T>

The event type.

Listener<T>

Receives each payload.

Disposable

A disposable that unsubscribes.

once<T>(type, listener): Disposable

Defined in: app/src/kernel/events/event-bus.ts:58

Subscribes to the next occurrence of an event type only.

T

EventType<T>

The event type.

Listener<T>

Receives the payload once.

Disposable

Defined in: app/src/kernel/events/event-bus.ts:9

A typed application event, such as TabActivated or SettingChanged. The type parameter is the payload.

T

readonly name: string

Defined in: app/src/kernel/events/event-bus.ts:11

Name for diagnostics and logs.

EventErrorHandler = (error, event) => void

Defined in: app/src/kernel/events/event-bus.ts:28

Receives listener errors of the EventBus.

unknown

EventType<unknown>

void

const EventBusToken: Token<EventBus>

Defined in: app/src/kernel/events/event-bus.ts:94

Token for the application-wide EventBus.

defineEvent<T>(name): EventType<T>

Defined in: app/src/kernel/events/event-bus.ts:23

Defines a new event type. Event types are compared by identity, not by name.

T

string

Name for diagnostics, conventionally in PascalCase.

EventType<T>