Skip to main content

abstractEvent <T>

The superclass of every event Octo emits.

Octo narrates its whole run as events - what registered, what changed, what terraform did, what each mode concluded. Subscribe with OnEvent to build logging, reporting, or notifications on top of a run without touching the framework. Emit your own by extending it.

@example
class DeployApprovedEvent extends Event<{ reviewer: string }> {}
EventService.getInstance().emit(new DeployApprovedEvent('deploy approved', { reviewer: 'ops-lead' }));
@group

Events

Hierarchy

Index

Constructors

Properties

Constructors

constructor

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

    • T = undefined

    Parameters

    • optionalname: string

      The subject of the event, when the event type alone does not identify it.

    • optionalpayload: T

      The event's data.

    Returns Event<T>

Properties

readonlyheader

header: { sequence: number; timestamp: number }

When the event was created. sequence counts every event this process created, so it orders two events created in the same millisecond, and events a late listener receives replayed.


Type declaration

  • sequence: number
  • timestamp: number

readonlyname

name: string

The subject of the event, when the event type alone does not identify it - e.g. the class name on a registration event. Empty otherwise.

readonlypayload

payload: T

The event's data. Its shape is fixed by the event type.

Page Options