Skip to main content

Home > blockly > ContextMenu > callbackFactory

ContextMenu.callbackFactory() function

Create a callback function that creates and configures a block, then places the new block next to the original and returns it.

Signature:

export declare function callbackFactory(block: Block, state: Element | serializationBlocks.State): () => BlockSvg;

Parameters

ParameterTypeDescription
blockBlockOriginal block.
stateElement | serializationBlocks.StateXML or JSON object representation of the new block.

Returns:

() => BlockSvg

Function that creates a block.