Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TimerEvent

An event sent by the timer module.

Hierarchy

Index

Properties

Methods

Properties

Readonly eventType

eventType: "timer" = TIMER_EVENT_TYPE

Methods

handleAs

  • handleAs<T>(eventClass: Constructor<T>): T
  • Force-cast the event as specified type.

    example

    Can be used to identify the type of the event in an automation:

    async handleEvent(event: AutomationEvent) {
      try {
        const timerEvent = event.handleAs(TimerEvent);
      } catch (e) {
        // ...
      }
    }
    throws

    Throws an error if the cast failed.

    Type parameters

    Parameters

    • eventClass: Constructor<T>

      An AutomationEvent subclass to cast this event to.

    Returns T

    An event casted to a type specified in eventClass argument.

Generated using TypeDoc