blockly > registry > register

registry.register() function

Registers a class based on a type and name.

Signature:

export declare function register<T>(type: string | Type<T>, name: string, registryItem: (new (...p1: any[]) => T) | null | any, opt_allowOverrides?: boolean): void;

Parameters

Parameter Type Description
type string | Type<T> The type of the plugin. (e.g. Field, Renderer)
name string The plugin's name. (Ex. field_angle, geras)
registryItem (new (...p1: any[]) => T) | null | any The class or object to register.
opt_allowOverrides boolean (Optional) True to prevent an error when overriding an already registered item.

Returns:

void

Exceptions

{Error} 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.