Skip to main content

Home > blockly > WorkspaceSvg > registerButtonCallback

WorkspaceSvg.registerButtonCallback() method

Register a callback function associated with a given key, for clicks on buttons and labels in the flyout. For instance, a button specified by the XML <button text="create variable" callbackKey="CREATE_VARIABLE">``</button> should be matched by a call to registerButtonCallback("CREATE_VARIABLE", yourCallbackFunction).

Signature:

registerButtonCallback(key: string, func: (p1: FlyoutButton) => void): void;

Parameters

ParameterTypeDescription
keystringThe name to use to look up this function.
func(p1: FlyoutButton) => voidThe function to call when the given button is clicked.

Returns:

void