Skip to main content

Home > blockly > fieldRegistry > register

fieldRegistry.register() function

Registers a field type. fieldRegistry.fromJson uses this registry to find the appropriate field type.

Signature:

export declare function register(type: string, fieldClass: RegistrableField): void;

Parameters

ParameterTypeDescription
typestringThe field type name as used in the JSON definition.
fieldClassRegistrableFieldThe field class containing a fromJson function that can construct an instance of the field.

Returns:

void

Exceptions

{Error} if the type name is empty or the fieldClass is not an object containing a fromJson function.