Blockly.Events. BlockChange
Constructor
BlockChange
new BlockChange(block, element, name, oldValue, newValue)
Class for a block change event.
Parameter |
|
---|---|
block |
The changed block. Null for a blank event. |
element |
string One of 'field', 'comment', 'disabled', etc. |
name |
string Name of input or field affected, or null. Value may be null. |
oldValue |
any type Previous value of element. |
newValue |
any type New value of element. |
- Extends
- Blockly.Events.BlockBase
Properties
blockId
unknown
The block id for the block this event pertains to
- Inherited from
- Blockly.Events.BlockBase#blockId
group
unknown
The event group id for the group this event belongs to. 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.Abstract#group
recordUndo
unknown
Sets whether the event should be added to the undo stack.
- Inherited from
- Blockly.Events.Abstract#recordUndo
workspaceId
unknown
The workspace identifier for this event.
- Inherited from
- Blockly.Events.Abstract#workspaceId
Methods
fromJson
fromJson(json)
Decode the JSON event.
Parameter |
|
---|---|
json |
JSON representation. Value must not be null. |
- Inherited from
- Blockly.Events.BlockBase#fromJson
getEventWorkspace_
getEventWorkspace_() returns Blockly.Workspace
Get workspace the event belongs to.
- Inherited from
- Blockly.Events.Abstract#getEventWorkspace_
- Throws
-
if workspace is null.
- Returns
-
The workspace the event belongs to.
isNull
isNull() returns boolean
Does this event record any change of state?
- Inherited from
- Blockly.Events.Abstract#isNull
- Returns
-
True if null, false if something changed.
run
run(_forward)
Run an event.
Parameter |
|
---|---|
_forward |
True if run forward, false if run backward (undo). |
- Inherited from
- Blockly.Events.Abstract#run
toJson
toJson() returns Object
Encode the event as JSON.
- Inherited from
- Blockly.Events.BlockBase#toJson
- Returns
-
JSON representation.