Skip to main content

Class: VarTypeChange

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

Notifies listeners that a variable's type has changed.

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.
oldTypeThe old type of the variable. Undefined for a blank event.
newTypeThe new type of the variable. Undefined for a blank event.

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 type change event.

Constructors​

Constructor​

new VarTypeChange(
variable?,
oldType?,
newType?
): VarTypeChange;

Defined in: packages/blockly/core/events/events_var_type_change.ts:35

Parameters​

ParameterTypeDescription
variable?IVariableModel<IVariableState>The variable whose type changed. Undefined for a blank event.
oldType?stringThe old type of the variable. Undefined for a blank event.
newType?stringThe new type of the variable. Undefined for a blank event.

Returns​

VarTypeChange

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_TYPE_CHANGE;

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

Type of this event.

Overrides​

VarBase.type


oldType?​

optional oldType?: string;

Defined in: packages/blockly/core/events/events_var_type_change.ts:37

The old type of the variable. Undefined for a blank event.


newType?​

optional newType?: string;

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

The new type of the variable. Undefined for a blank event.

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(): VarTypeChangeJson;

Defined in: packages/blockly/core/events/events_var_type_change.ts:48

Encode the event as JSON.

Returns​

VarTypeChangeJson

JSON representation.

Overrides​

VarBase.toJson


run()​

run(forward): void;

Defined in: packages/blockly/core/events/events_var_type_change.ts:90

Run a variable type change event.

Parameters​

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

Returns​

void

Overrides​

VarBase.run