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

Parameter Type Description
block Block Original block.
state Element | serializationBlocks.State XML or JSON object representation of the new block.

Returns:

() => BlockSvg

Function that creates a block.