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

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
listener
Callback that executes when the manual event triggers. Payload: a UNIX timestamp integer.
callback
Output
Returns the string subscribed.
Example

startAutoTrigger
Starts generating periodic automatic events at a specified interval.
Parameters
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
listener
Callback that executes when the automatic event triggers. Payload: a UNIX timestamp integer.
callback
Output
Returns the string subscribed.
Example

stopAutoTrigger
Stops the active automatic trigger and halts periodic event generation.
Parameters
None.
Output
Returns true.
Example

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
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

delete
Removes the instance and clears its configuration.
Parameters
None.
Output
Returns true upon removal.
Example

Last updated
Was this helpful?