Declaring Scenarios with Desktop SDK
Declare the Scenario
A scenario is declared in a process or an application using the scenario method:
A scenario handler contains code that will be executed when the scenario starts. This callback receives the following parameters:
-
ev : current (last received) event
-
sc : this scenario object (see Class ctx.scenarioClass )
Implement Your Code Inside the Handler
A scenario handler may contain:
-
An optional onTimeout handler which is called if a timeout appears (see Managing Timeouts in Scenarios).
-
An optional onError handler which is called if an error occurs (see Managing Errors).
-
Initialization code (for example, Starting mode)
-
A list of steps that are concatenated and started sequentially during scenario execution.
Set the Starting Mode
The scenario’s starting mode determines what appends when the scenario starts. You can set the starting mode using the setMode method. The main available modes are as follows (see Enumeration e.scenario.mode ):
-
clearIfRunning: if a scenario with the same name is running, it is cancelled
-
noStartIfRunning: if a scenario with the same name is running, the new scenario is not started
-
clearAll: all running scenarios are cancelled