Skip to main content

Function: register()

function register<T>(
type,
name,
registryItem,
opt_allowOverrides?
): void;

Defined in: packages/blockly/core/registry.ts:141

Registers a class based on a type and name.

Type Parameters

Type Parameter
T

Parameters

ParameterTypeDescription
typestring | Type<T>The type of the plugin. (e.g. Field, Renderer)
namestringThe plugin's name. (Ex. field_angle, geras)
registryItemanyThe class or object to register.
opt_allowOverrides?booleanTrue to prevent an error when overriding an already registered item.

Returns

void

Throws

if the type or name is empty, a name with the given type has already been registered, or if the given class or object is not valid for its type.