blockly > Names

Names class

Class for a database of entity names (variables, procedures, etc).

Signature:

export declare class Names 

Constructors

Constructor Modifiers Description
(constructor)(reservedWordsList, opt_variablePrefix) Constructs a new instance of the Names class

Properties

Property Modifiers Type Description
DEVELOPER_VARIABLE_TYPE static NameType

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.