A base class for events passed to automations. Every automation event provides the eventType string field that allows for identification of the event type inside the automation.
A type of this event. Used for routing and filtering of events.
Can be used to identify the type of the event in automation:
async handleEvent(event: TimerEvent) { if(isTimerEvent(event)) console.log(`${this.name} was triggered!`); }
Force-cast the event as specified type.
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 an error if the cast failed.
An AutomationEvent subclass to cast this event to.
An event casted to a type specified in eventClass argument.
eventClass
Generated using TypeDoc
A base class for events passed to automations. Every automation event provides the eventType string field that allows for identification of the event type inside the automation.