UNPKG

@mbc-cqrs-serverless/core

Version:
19 lines (18 loc) 617 B
import 'reflect-metadata'; import { IEvent } from '../interfaces/event.interface'; /** * Decorator that marks a class as an event handler. * The handler will be invoked when the specified event is published. * * @param event - The event class or instance to handle * @example * ```typescript * @EventHandler(OrderCreatedEvent) * export class OrderCreatedHandler implements IEventHandler<OrderCreatedEvent> { * async handle(event: OrderCreatedEvent) { * // Handle the event * } * } * ``` */ export declare const EventHandler: (event: IEvent | (new (...args: any[]) => IEvent)) => ClassDecorator;