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.


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


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


() => BlockSvg

Function that creates a block.