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

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

Properties

Property Modifiers Type Description
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.
newValue unknown The new value of the element.
oldValue unknown The original value of the element.
type string

Methods

Method Modifiers Description
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.