Skip to main content

Home > blockly > Events > BlockChange

Events.BlockChange class

Notifies listeners when some element of a block has changed (e.g. field values, comments, etc).

Signature:

export declare class BlockChange extends BlockBase 

Extends: BlockBase

Constructors

ConstructorModifiersDescription
(constructor)(opt_block, opt_element, opt_name, opt_oldValue, opt_newValue)Constructs a new instance of the BlockChange class

Properties

PropertyModifiersTypeDescription
element?string(Optional) The element that changed; one of 'field', 'comment', 'collapsed', 'disabled', 'inline', or 'mutation'
name?string(Optional) The name of the field that changed, if this is a change to a field.
newValueunknownThe new value of the element.
oldValueunknownThe original value of the element.
typeEventType

Methods

MethodModifiersDescription
isNull()Does this event record any change of state?
run(forward)Run a change event.
setDisabledReason(disabledReason)Set the language-neutral identifier for the reason why the block was or was not disabled. This is only valid for events where element is 'disabled'. Defaults to 'MANUALLY_DISABLED'.
toJson()Encode the event as JSON.