API.RAPID. Variable

new Variable(variable, props)

This class represents a RAPID variable.

Parameters:
NameTypeDescription
variableRWS.Rapid.Data
propsVariableProps

See VariableProps

Properties
NameTypeDescription
varobject

Object returned by RWS.Rapid.getData().

Methods

onChanged(callback)

Add a callback function to be executed when the variable value changes

Parameters:
NameTypeDescription
callback*

The callback function that is called when the variable value changes.

(async) subscribe(raiseInitial) → {undefined|Promise.<{}>}

Subscribes to a RAPID variable

Parameters:
NameTypeDefaultDescription
raiseInitialbooleanfalse

Raises an event after subscription

Returns:

Undefined at success, reject Promise at failure.

Type: 
undefined | Promise.<{}>

(async) unsubscribe() → {undefined|Promise.<{}>}

Unsubscribes a RAPID variable

Returns:

Undefined at success, reject Promise at failure.

Type: 
undefined | Promise.<{}>