Blockly.Events. BlockChange
Class for a block change event.
Constructor
BlockChange
new BlockChange(opt_block, opt_element, opt_name, opt_oldValue, opt_newValue)
Parameter |
|
---|---|
opt_block |
Optional The changed block. Undefined for a blank event. Value must not be null. |
opt_element |
Optional One of 'field', 'comment', 'disabled', etc. |
opt_name |
Optional Name of input or field affected, or null. Value may be null. |
opt_oldValue |
Optional Previous value of element. |
opt_newValue |
Optional New value of element. |
- Extends
- Blockly.Events.BlockBase
Properties
type
string
Type of this event.
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
isBlank
unknown
Whether or not the event is blank (to be populated by fromJson).
- Inherited from
- Blockly.Events.Abstract#isBlank
isUiEvent
unknown
Whether or not the event is a UI event.
- Inherited from
- Blockly.Events.Abstract#isUiEvent
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.BlockBase#workspaceId
Methods
getExtraBlockState_
getExtraBlockState_(block) returns string
Returns the extra state of the given block (either as XML or a JSO, depending on the block's definition).
Parameter |
|
---|---|
block |
The block to get the extra state of. Value must not be null. |
- Returns
-
string
A stringified version of the extra state of the given block.
fromJson
fromJson(json)
Decode the JSON event.
Parameter |
|
---|---|
json |
Object JSON representation. Value must not be null. |
isNull
isNull() returns boolean
Does this event record any change of state?
- Returns
-
boolean
False if something changed.
run
run(forward)
Run a change event.
Parameter |
|
---|---|
forward |
boolean True if run forward, false if run backward (undo). |
toJson
toJson() returns Object
Encode the event as JSON.
- Returns
-
non-null Object
JSON representation.
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.