Skip to main content

switchState

Changes the state of a layer.

Field Configurations

KeyTypeDescriptionDefault Value
"params" (required)Objectundefinednull

Parameters

KeyTypeDescriptionDefault Value
"async"BooleanSpecifies whether the action should perform asynchronously.null
"duration"Number,StringDetermines how long the state should be switched for.null
"layer" (required)StringName of the layer which should switch.null
"states" (required)ArrayList of possible states to switch between.null

Inherited

From Base Action

Base Action

Field Configurations

KeyTypeDescriptionDefault Value
"dynamicParams"ObjectDynamic params to retrieve data from a specific context e.g. a userSetting.null
"leadingDelimiter"StringThe leading mustache delimiter to use.null
"params"Object,ArrayObject containing the properties of the action.null
"trailingDelimiter"StringThe trailing mustache delimiter to use.null
"type"StringType name of the action.null

Examples

Example 1: Switch the state of a layer

Goal: Show or hide a layer.

The state of the layer errorText should switch between hidden and visible.

{
"type": "switchState",
"params": {
"layer": "errorText",
"states": [
"visible",
"hidden"
]
}
}

The actions to be executed are specified in the actions parameter, in this case a switchState action.

Result:

Screencapture of the app showing the results of the sample code from Example 1.
A switchState action has been created.