method IEventBus.subscribe
IEventBus.subscribe<T>(
type: string,
handler: EventHandler<T>
): Unsubscribe

Subscribes to an event type.

Type Parameters

The event payload type

Parameters

type: string

Event type name

handler: EventHandler<T>

Invoked for each published event of the type

Return Type

Call to remove the subscription

Usage

import { type IEventBus } from "common/src/index.ts";