interface EventHandlerRegistration
Since 0.1.0

One event handler and the event type it subscribes to.

A PAIR rather than a bare handler because IEventBus.subscribe(type, handler) routes on the type string, and an IEventHandler carries no type of its own — the emitted handler module declares it as a separate constant.

IEventHandler<unknown> accepts a concretely-typed handler because handle is declared with method syntax, so TypeScript compares its parameter bivariantly even under strictFunctionTypes — which is what keeps this list heterogeneous without any.

Properties

readonly
type: string

Event type name, matching event.type.

readonly
handler:
IEventHandler<unknown>
| RegistryFactory<IEventHandler<unknown>>

The handler to subscribe for that type, or a factory that builds one from the service registry.

An instance subscribes during register() through subscribeHandler. A factory is called at the onInit phase — after every plugin has registered — and its result subscribes through the SAME subscribeHandler, so the option and the manual route cannot drift.

Usage

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