Skip to main content

Home > 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

ParameterTypeDescription
onchangeFn(p1: Abstract) => voidThe callback to call when the block's workspace changes.

Returns:

void

Exceptions

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