mirror of
https://github.com/google/blockly.git
synced 2026-01-06 08:30:13 +01:00
fix: Allow reregistering fields. (#9290)
This commit is contained in:
@@ -56,11 +56,11 @@ export interface RegistrableField {
|
|||||||
* @param type The field type name as used in the JSON definition.
|
* @param type The field type name as used in the JSON definition.
|
||||||
* @param fieldClass The field class containing a fromJson function that can
|
* @param fieldClass The field class containing a fromJson function that can
|
||||||
* construct an instance of the field.
|
* construct an instance of the field.
|
||||||
* @throws {Error} if the type name is empty, the field is already registered,
|
* @throws {Error} if the type name is empty or the fieldClass is not an object
|
||||||
* or the fieldClass is not an object containing a fromJson function.
|
* containing a fromJson function.
|
||||||
*/
|
*/
|
||||||
export function register(type: string, fieldClass: RegistrableField) {
|
export function register(type: string, fieldClass: RegistrableField) {
|
||||||
registry.register(registry.Type.FIELD, type, fieldClass);
|
registry.register(registry.Type.FIELD, type, fieldClass, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user