For the complete documentation index, see llms.txt. This page is also available as Markdown.

Event simulation

The event simulation class simulates various events to test and validate workflows. Generating mock events ensures that flows handle different scenarios and edge cases effectively. It also serves as a placeholder in a flow before you complete your App. To learn more about event handlers, see callbacks.

To access the event simulation functions, unfold Simulation > Events in the Function Explorer. This class requires an instance. The code class name is Trigger.

create

Constructs a new event simulation instance.

Parameters

None.

Output

Returns the name of the created instance.

Example

Create an event simulation instance

triggerManually

Triggers a manual event within the instance to activate the onManualTrigger listener.

Parameters

None.

Output

Returns true.

onManualTrigger

Fires when you execute the triggerManually function within the same instance.

Parameters

Input
Description
Type

listener

Callback that executes when the manual event triggers. Payload: a UNIX timestamp integer.

callback

Output

Returns the string subscribed.

Example

The listener outputs the timestamp after a manual trigger

startAutoTrigger

Starts generating periodic automatic events at a specified interval.

Parameters

Input
Description
Type

interval

The repetition interval in milliseconds. Default 1000.

integer

Output

Returns the string started.

onAutoTrigger

Fires periodically when an automatic trigger is active.

Initializing the listener

You may need to trigger onAutoTrigger once to start reacting to automatically generated events after calling startAutoTrigger.

Parameters

Input
Description
Type

listener

Callback that executes when the automatic event triggers. Payload: a UNIX timestamp integer.

callback

Output

Returns the string subscribed.

Example

React periodically to automatic events

stopAutoTrigger

Stops the active automatic trigger and halts periodic event generation.

Parameters

None.

Output

Returns true.

Example

Stop event generation

triggerCallback

Triggers an event that executes its own callback after a specified delay. To prevent infinite loops, the function does not react to the output of its own callback.

Parameters

Input
Description
Type

listener

Callback that executes after the timeout delay. Payload: a Unix timestamp in milliseconds.

callback

timeout

The delay duration in milliseconds before the callback executes. Default 3000.

integer

Output

Returns a string stating when the callback will run, for example Calling back in 3 seconds.

Example

Callback execution after a timeout delay

delete

Removes the instance and clears its configuration.

Irreversible action

Parameters

None.

Output

Returns true upon removal.

Example

Delete an event simulation instance

Last updated

Was this helpful?