Skip to main content

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

Parameter

Type

Description

key

string

The name to use to look up this function.

func

(p1: FlyoutButton) => void

The function to call when the given button is clicked.

Returns:

void