Function: createVariableButtonHandler()
function createVariableButtonHandler(
workspace,
opt_callback?,
opt_type?
): void;
Defined in: packages/blockly/core/variables.ts:355
Handles "Create Variable" button in the default variables toolbox category. It will prompt the user for a variable name, including re-prompts if a name is already in use among the workspace's variables.
Custom button handlers can delegate to this function, allowing variables types and after-creation processing. More complex customization (e.g., prompting for variable type) is beyond the scope of this function.
Parameters
| Parameter | Type | Description |
|---|---|---|
workspace | WorkspaceSvg | The workspace on which to create the variable. |
opt_callback? | (p1?) => void | 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. |
opt_type? | string | The type of the variable like 'int', 'string', or ''. This will default to '', which is a specific type. |
Returns
void