Stay organized with collections
Save and categorize content based on your preferences.
blockly > Names
Names class
Class for a database of entity names (variables, procedures, etc).
Signature:
export declare class Names
Constructors
Properties
Methods
Method |
Modifiers |
Description |
equals(name1, name2) |
static |
Do the given two entity names refer to the same entity? Blockly names are case-insensitive. |
getDistinctName(name, type) |
|
Convert a Blockly entity name to a legal exportable entity name. Ensure that this is a new name not overlapping any previously defined name. Also check against list of reserved words for the current language and ensure name doesn't collide. |
getName(nameOrId, type) |
|
Convert a Blockly entity name to a legal exportable entity name. |
getUserNames(type) |
|
Return a list of all known user-created names of a specified name type. |
populateProcedures(workspace) |
|
Generate names for procedures. |
populateVariables(workspace) |
|
Generate names for user variables, but only ones that are being used. |
reset() |
|
Empty the database and start from scratch. The reserved words are kept. |
setVariableMap(map) |
|
Set the variable map that maps from variable name to variable object. |
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 2024-09-18 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 2024-09-18 UTC."],[[["The `Names` class manages a database of entity names in Blockly, such as variables and procedures, ensuring they are unique and do not conflict with reserved words."],["It provides methods for generating, converting, and comparing names, and for populating the database with names from the workspace."],["This class helps maintain consistency and avoid naming conflicts when working with Blockly entities."],["The `Names` class also stores a map of variables and their corresponding objects."]]],[]]