Skip to main content

Event <T>

The Event class is the superclass for all events. An event is generated when something important happens in Octo. The body of the event contains a header, name (optional), and payload (optional).

@example
const myEvent = new Event<{ value: string }>('event name', { value: 'my payload' });
EventService.getInstance().emit(myEvent);
@group

Events

@returns

The Event instance.

Hierarchy

Index

Constructors

Properties

Methods

Constructors

constructor

  • Event<T>(name?: string, payload?: T): Event<T>
  • Type parameters

    • T = undefined

    Parameters

    • optionalname: string
    • optionalpayload: T

    Returns Event<T>

Properties

readonlyheader

header: { timestamp: number }

Type declaration

  • timestamp: number

readonlyname

name: string

readonlypayload

payload: T

Methods

staticregistrar

  • registrar(...args: [EventService, PropertyDescriptor]): void
  • The registrar() method is explicitly called by the EventSource decorator for a method to enhance that method to auto-emit events.


    Parameters

    • rest...args: [EventService, PropertyDescriptor]

      Arguments are spread out using the array spread operator.

    Returns void