Skip to main content

Function: register()

function register<T>(name, initFn): void;

Defined in: packages/blockly/core/extensions.ts:30

Registers a new extension function. Extensions are functions that help initialize blocks, usually adding dynamic behavior such as onchange handlers and mutators. These are applied using Block.applyExtension(), or the JSON "extensions" array attribute.

Type Parameters

Type Parameter
T extends Block

Parameters

ParameterTypeDescription
namestringThe name of this extension.
initFn(this) => voidThe function to initialize an extended block.

Returns

void

Throws

if the extension name is empty, the extension is already registered, or extensionFn is not a function.