ScriptStep
public class ScriptStep : Step
Step that runs some JavaScript which will return a result immediately from the JavaScript function.
The StepFlowResult
returned by the handler
can be used to drive control flow of the steps.
-
Initializer.
Declaration
Swift
public init( functionName: String, params: Any..., paramsKeys: [String] = [], handler: @escaping ScriptStepHandler )
Parameters
functionName
The name of the JavaScript function to call. The module namespace is automatically added.
params
Parameters which will be passed to the JavaScript function.
paramsKeys
Look up the values from the JSON model dictionary using these keys, and pass them as the parameters to the JavaScript function. If provided, these are used instead of
params
.handler
Callback function which returns data from JavaScript, and passes the model JSON dictionary for modification.
-
Declaration
Swift
public func run(with browser: Browser, model: JSON, completion: @escaping StepCompletionCallback)