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
| Parameter | Type | Description |
|---|---|---|
name | string | The name of this extension. |
initFn | (this) => void | The 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.