Skip to main content

Function: registerMutator()

function registerMutator(
name,
mixinObj,
opt_helperFn?,
opt_blockList?
): void;

Defined in: packages/blockly/core/extensions.ts:76

Registers a new extension function that adds a mutator to the block. At register time this performs some basic sanity checks on the mutator. The wrapper may also add a mutator dialog to the block, if both compose and decompose are defined on the mixin.

Parameters​

ParameterTypeDescription
namestringThe name of this mutator extension.
mixinObjanyThe values to mix in.
opt_helperFn?() => anyAn optional function to apply after mixing in the object.
opt_blockList?string[]A list of blocks to appear in the flyout of the mutator dialog.

Returns​

void

Throws​

if the mutation is invalid or can't be applied to the block.