Skip to main content

OnEvent

Callable

  • OnEvent(ofType: Constructable<Event<unknown>>): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void

  • An @OnEvent is a method decorator to listen to an event.

    @example
    // Async handler.
    @OnEvent(MyEvent)
    async onEvent(event: MyEvent): Promise<void> { ... }

    // Sync handler.
    @OnEvent(MyEvent)
    onEvent(event: MyEvent): void { ... }

    Parameters

    Returns (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void

    The decorated method.

      • (target: any, propertyKey: string, descriptor: PropertyDescriptor): void
      • Parameters

        • target: any
        • propertyKey: string
        • descriptor: PropertyDescriptor

        Returns void