Skip to main content

Class: VarRename

Defined in: packages/blockly/core/events/events_var_rename.ts:23

Notifies listeners that a variable model was renamed.

Extends​

Properties index​

PropertyDescription
workspaceIdThe workspace identifier for this event.
groupAn ID for the group of events this block is associated with.
recordUndoWhether this event is undoable or not.
isUiEventWhether or not the event is a UI event.
isBlankWhether or not the event was constructed without necessary parameters (to be populated by fromJson).
varIdThe ID of the variable this event references.
typeType of this event.
oldNameThe previous name of the variable.
newNameThe new name of the variable.

Methods index​

MethodDescription
isNullDoes this event record any change of state?
getEventWorkspace_Get workspace the event belongs to.
toJsonEncode the event as JSON.
runRun a variable rename event.

Constructors​

Constructor​

new VarRename(opt_variable?, newName?): VarRename;

Defined in: packages/blockly/core/events/events_var_rename.ts:36

Parameters​

ParameterTypeDescription
opt_variable?IVariableModel<IVariableState>The renamed variable. Undefined for a blank event.
newName?stringThe new name the variable will be changed to.

Returns​

VarRename

Overrides​

VarBase.constructor

Properties​

workspaceId?​

optional workspaceId?: string = undefined;

Defined in: packages/blockly/core/events/events_abstract.ts:30

The workspace identifier for this event.

Inherited from​

VarBase.workspaceId


group​

group: string;

Defined in: packages/blockly/core/events/events_abstract.ts:38

An ID for the group of events this block is associated with.

Groups define events that should be treated as an single action from the user's perspective, and should be undone together.

Inherited from​

VarBase.group


recordUndo​

recordUndo: boolean;

Defined in: packages/blockly/core/events/events_abstract.ts:41

Whether this event is undoable or not.

Inherited from​

VarBase.recordUndo


isUiEvent​

isUiEvent: boolean = false;

Defined in: packages/blockly/core/events/events_abstract.ts:44

Whether or not the event is a UI event.

Inherited from​

VarBase.isUiEvent


isBlank​

isBlank: boolean = true;

Defined in: packages/blockly/core/events/events_var_base.ts:26

Whether or not the event was constructed without necessary parameters (to be populated by fromJson).

Inherited from​

VarBase.isBlank


varId?​

optional varId?: string;

Defined in: packages/blockly/core/events/events_var_base.ts:28

The ID of the variable this event references.

Inherited from​

VarBase.varId


type​

type: EventType = EventType.VAR_RENAME;

Defined in: packages/blockly/core/events/events_var_rename.ts:24

Type of this event.

Overrides​

VarBase.type


oldName?​

optional oldName?: string;

Defined in: packages/blockly/core/events/events_var_rename.ts:27

The previous name of the variable.


newName?​

optional newName?: string;

Defined in: packages/blockly/core/events/events_var_rename.ts:30

The new name of the variable.

Methods​

isNull()​

isNull(): boolean;

Defined in: packages/blockly/core/events/events_abstract.ts:91

Does this event record any change of state?

Returns​

boolean

True if null, false if something changed.

Inherited from​

VarBase.isNull


getEventWorkspace_()​

getEventWorkspace_(): Workspace;

Defined in: packages/blockly/core/events/events_abstract.ts:111

Get workspace the event belongs to.

Returns​

Workspace

The workspace the event belongs to.

Throws​

if workspace is null.

Inherited from​

VarBase.getEventWorkspace_


toJson()​

toJson(): VarRenameJson;

Defined in: packages/blockly/core/events/events_var_rename.ts:51

Encode the event as JSON.

Returns​

VarRenameJson

JSON representation.

Overrides​

VarBase.toJson


run()​

run(forward): void;

Defined in: packages/blockly/core/events/events_var_rename.ts:99

Run a variable rename event.

Parameters​

ParameterTypeDescription
forwardbooleanTrue if run forward, false if run backward (undo).

Returns​

void

Overrides​

VarBase.run