Stay organized with collections
Save and categorize content based on your preferences.
blockly > Events > VarRename > (constructor)
Events.VarRename.(constructor)
Constructs a new instance of the VarRename
class
Signature:
constructor(opt_variable?: IVariableModel<IVariableState>, newName?: string);
Parameters
Parameter |
Type |
Description |
opt_variable |
IVariableModel<IVariableState> |
(Optional) The renamed variable. Undefined for a blank event. |
newName |
string |
(Optional) The new name the variable will be changed to. |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-05-16 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-05-16 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eEvents.VarRename\u003c/code\u003e class constructor creates a new instance of the \u003ccode\u003eVarRename\u003c/code\u003e class, signifying a variable rename event within Blockly applications.\u003c/p\u003e\n"],["\u003cp\u003eThis constructor optionally accepts the \u003ccode\u003eVariableModel\u003c/code\u003e object of the renamed variable and the variable's new name as parameters.\u003c/p\u003e\n"],["\u003cp\u003eThese parameters, \u003ccode\u003eopt_variable\u003c/code\u003e and \u003ccode\u003enewName\u003c/code\u003e, help in defining the specifics of the variable rename event.\u003c/p\u003e\n"]]],["The `VarRename` class constructor creates a new instance for renaming a variable. It accepts two optional parameters: `opt_variable`, a `VariableModel` representing the variable being renamed, and `newName`, a string specifying the variable's new name. If `opt_variable` is undefined, it indicates a blank event. The class facilitates the process of tracking and applying variable name changes within the system.\n"],null,["[blockly](./blockly.md) \\\u003e [Events](./blockly.events_namespace.md) \\\u003e [VarRename](./blockly.events_namespace.varrename_class.md) \\\u003e [(constructor)](./blockly.events_namespace.varrename_class._constructor__1_constructor.md)\n\nEvents.VarRename.(constructor)\n------------------------------\n\nConstructs a new instance of the `VarRename` class\n\n**Signature:** \n\n constructor(opt_variable?: IVariableModel\u003cIVariableState\u003e, newName?: string);\n\nParameters\n----------\n\n| Parameter | Type | Description |\n|--------------|--------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------|\n| opt_variable | [IVariableModel](./blockly.ivariablemodel_interface.md)\\\u003c[IVariableState](./blockly.ivariablestate_interface.md)\\\u003e | *(Optional)* The renamed variable. Undefined for a blank event. |\n| newName | string | *(Optional)* The new name the variable will be changed to. |"]]