Skip to main content

Function: renameVariable()

function renameVariable(
workspace,
variable,
opt_callback?
): void;

Defined in: packages/blockly/core/variables.ts:428

Opens a prompt that allows the user to enter a new name for a variable. Triggers a rename if the new name is valid. Or re-prompts if there is a collision.

Parameters

ParameterTypeDescription
workspaceWorkspaceThe workspace on which to rename the variable.
variableIVariableModel<IVariableState>Variable to rename.
opt_callback?(p1?) => voidA callback. It will be passed an acceptable new variable name, or null if change is to be aborted (cancel button), or undefined if an existing variable was chosen.

Returns

void