interface EventsPluginOptions
Since 0.1.0

Options for the EventsPlugin.

Properties

Since 0.1.0
optional
handlers: readonly EventHandlerRegistration[]

Handlers subscribed to the bus at register() time.

The declarative alternative to resolving CAPABILITIES.EVENTS and calling subscribeHandler imperatively — which application code has no phase to do, since IApplication exposes no lifecycle hooks and the bus does not exist until this plugin has registered. Both routes go through the same subscribeHandler, so neither can drift from the other.

The Unsubscribe each subscription returns is deliberately dropped: the bus is cleared on shutdown (onClose), and there is no caller that could hold the handle.

Default: [] (no subscriptions).

optional
async: boolean

Dispatch policy for event handlers.

  • false (default): publish/publishBatch await all handlers before resolving (deterministic ordering).
  • true: fire-and-forget; publish resolves immediately, handler errors are routed to errorHandler asynchronously.
optional
errorHandler: (
error: unknown,
) => void

Handler for errors thrown/rejected by event handlers.

Defaults to logging via the optional logger capability if present, else a no-op. Errors never cause publish to reject.

Usage

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