Optionaloptions: EventsPluginOptions
Plugin configuration
The plugin instance
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.
Creates the EventsPlugin.
Registers an
IEventBusunderCAPABILITIES.EVENTS. Single instance only (nonameoption — adding one would be a dead option per CLAUDE.md).