Skip to main content

Home > blockly > Workspace > getVariableById

Workspace.getVariableById() method

Warning: This API is now obsolete.

v12: use Blockly.Workspace.getVariableMap().getVariableById.

Find the variable by the given ID and return it. Return null if not found.

Signature:

getVariableById(id: string): IVariableModel<IVariableState> | null;

Parameters

ParameterTypeDescription
idstringThe ID to check for.

Returns:

IVariableModel<IVariableState> | null

The variable with the given ID.