EventsPlugin(options?: EventsPluginOptions): IPlugin
Creates the EventsPlugin.
Registers an IEventBus under CAPABILITIES.EVENTS. Single instance only
(no name option — adding one would be a dead option per CLAUDE.md).
Example 1
Example 1
import { EventsPlugin } from '@setu-ts/events-plugin'; app.register(EventsPlugin({ async: true, handlers: [ { type: 'user-created', handler: new UserCreatedEventHandler() }, { type: 'order-placed', handler: createOrderPlacedEventHandler }, ], }));
handlers accepts an instance or a RegistryFactory
((services: IServiceRegistry) => IEventHandler). A factory is resolved at onInit
— the first phase at which the registry holds every capability — and subscribes
through the same subscribeHandler the instance arm uses. Instance handlers keep
their register() timing.
optional
options: EventsPluginOptions
Plugin configuration