method InMemoryEventBus.prototype.subscribe
InMemoryEventBus.prototype.subscribe<T>(
type: string,
handler: EventHandler<T>
): () => void

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

() => void

Call to remove the subscription

Usage

import { InMemoryEventBus } from "events-plugin/src/index.ts";