Instance methods
TriggerClient: on() instance method
Use the on()
method to listen for run notifications across all Jobs.
These are the docs for Trigger.dev v2 which will be deprecated on January 31st, 2025. You probably want the v3 docs.
You can subscribe to run notifications across all your Jobs using the on()
instance method, which currently supports two events:
runSucceeded
: Triggered when a run succeeds.runFailed
: Triggered when a run fails.
Both events receive a Run Notification object as their only parameter.
You can use the notification to determine which job the run belongs to, access the run’s payload, output, errors, and more.
If you want to subscribe to just a single Job, see the defineJob docs.
Parameters
The notification event to listen for.
The callback function to run when the event is triggered. Receives a Run Notification object as it’s only parameter.