blockly > Block > setOnChange

Block.setOnChange() method

Sets a callback function to use whenever the block's parent workspace changes, replacing any prior onchange handler. This is usually only called from the constructor, the block type initializer function, or an extension initializer function.

Signature:

setOnChange(onchangeFn: (p1: Abstract) => void): void;

Parameters

Parameter Type Description
onchangeFn (p1: Abstract) => void The callback to call when the block's workspace changes.

Returns:

void

Exceptions

{Error} if onchangeFn is not falsey and not a function.