Skip to main content

Class: BlockShadowStateChange

Defined in: plugins/shadow-block-converter/src/shadow_block_converter.ts:24

A Blockly event class to revert a block connection's shadow state to the provided state, to be used after attaching a child block that would ordinarily overwrite the connection's shadow state.

Extends​

  • BlockBase

Properties index​

PropertyDescription
blockIdThe ID of the block associated with this event.
groupAn ID for the group of events this block is associated with.
inputIndexInParentThe index of the connection in the parent block's list of connections. If null, then the nextConnection will be used instead.
isBlankWhether or not the event was constructed without necessary parameters (to be populated by fromJson).
isUiEventWhether or not the event is a UI event.
recordUndoWhether this event is undoable or not.
shadowStateThe intended shadow state of the connection.
typeType of this event.
workspaceIdThe workspace identifier for this event.
EVENT_TYPEThe name of the event type for broadcast and listening purposes.

Methods index​

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

Constructors​

Constructor​

new BlockShadowStateChange(
block,
inputIndexInParent,
shadowState
): BlockShadowStateChange;

Defined in: plugins/shadow-block-converter/src/shadow_block_converter.ts:51

The constructor for a new BlockShadowStateChange event.

Parameters​

ParameterTypeDescription
blockBlockThe parent of the connection to modify.
inputIndexInParentnumber | nullThe index of the input associated with the connection to modify, if it is associated with one. Otherwise the nextConnection will be used.
shadowStateStateThe intended shadow state of the connection.

Returns​

BlockShadowStateChange

Overrides​

Blockly.Events.BlockBase.constructor

Properties​

blockId?​

blockId?: string;

The ID of the block associated with this event.

Inherited from​

Blockly.Events.BlockBase.blockId


group​

group: string;

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​

Blockly.Events.BlockBase.group


inputIndexInParent​

inputIndexInParent: number | null;

Defined in: plugins/shadow-block-converter/src/shadow_block_converter.ts:35

The index of the connection in the parent block's list of connections. If null, then the nextConnection will be used instead.


isBlank​

isBlank: boolean;

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

Inherited from​

Blockly.Events.BlockBase.isBlank


isUiEvent​

isUiEvent: boolean;

Whether or not the event is a UI event.

Inherited from​

Blockly.Events.BlockBase.isUiEvent


recordUndo​

recordUndo: boolean;

Whether this event is undoable or not.

Inherited from​

Blockly.Events.BlockBase.recordUndo


shadowState​

shadowState: State;

Defined in: plugins/shadow-block-converter/src/shadow_block_converter.ts:40

The intended shadow state of the connection.


type​

type: string;

Type of this event.

Inherited from​

Blockly.Events.BlockBase.type


workspaceId?​

workspaceId?: string;

The workspace identifier for this event.

Inherited from​

Blockly.Events.BlockBase.workspaceId


EVENT_TYPE​

readonly static EVENT_TYPE: "block_shadow_state_change" = 'block_shadow_state_change';

Defined in: plugins/shadow-block-converter/src/shadow_block_converter.ts:29

The name of the event type for broadcast and listening purposes.

Methods​

getEventWorkspace_()​

getEventWorkspace_(): Workspace;

Get workspace the event belongs to.

Returns​

Workspace

The workspace the event belongs to.

Throws​

if workspace is null.

Inherited from​

Blockly.Events.BlockBase.getEventWorkspace_


isNull()​

isNull(): boolean;

Defined in: plugins/shadow-block-converter/src/shadow_block_converter.ts:104

Does this event record any change of state?

Returns​

boolean

False if something changed.

Overrides​

Blockly.Events.BlockBase.isNull


run()​

run(forward): void;

Defined in: plugins/shadow-block-converter/src/shadow_block_converter.ts:114

Run a change event.

Parameters​

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

Returns​

void

Overrides​

Blockly.Events.BlockBase.run


toJson()​

toJson(): BlockShadowStateChangeJson;

Defined in: plugins/shadow-block-converter/src/shadow_block_converter.ts:69

Encode the event as JSON.

Returns​

BlockShadowStateChangeJson

JSON representation.

Overrides​

Blockly.Events.BlockBase.toJson


fromJson()​

static fromJson(
json,
workspace,
event?
): BlockShadowStateChange;

Defined in: plugins/shadow-block-converter/src/shadow_block_converter.ts:82

Decode the JSON event.

Parameters​

ParameterTypeDescription
jsonBlockShadowStateChangeJsonJSON representation.
workspaceWorkspace-
event?any-

Returns​

BlockShadowStateChange

Overrides​

Blockly.Events.BlockBase.fromJson