blockly > Field > (constructor)

Field.(constructor)

Constructs a new instance of the Field class

Signature:

constructor(value: T | typeof Field.SKIP_SETUP, validator?: FieldValidator<T> | null, config?: FieldConfig);

Parameters

Parameter Type Description
value T | typeof Field.SKIP_SETUP The initial value of the field. Also accepts Field.SKIP_SETUP if you wish to skip setup (only used by subclasses that want to handle configuration and setting the field value after their own constructors have run).
validator FieldValidator<T> | null (Optional) A function that is called to validate changes to the field's value. Takes in a value & returns a validated value, or null to abort the change.
config FieldConfig (Optional) A map of options used to configure the field. Refer to the individual field's documentation for a list of properties this parameter supports.