blockly > Variables > renameVariable
Variables.renameVariable() function
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.
Signature:
export declare function renameVariable(workspace: Workspace, variable: IVariableModel<IVariableState>, opt_callback?: (p1?: string | null) => void): void;
Parameters
| Parameter | Type | Description |
|---|---|---|
| workspace | Workspace | The workspace on which to rename the variable. |
| variable | IVariableModel<IVariableState> | Variable to rename. |
| opt_callback | (p1?: string | null) => void | (Optional) A 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