Interface ValidatorAPI
interface ValidatorAPI {
enabled: boolean;
get length(): number;
[iterator](): IterableIterator<ValidatorData, any, any>;
add(...validators: (ValidatorData | ValidatorFn)[]): void;
clear(): void;
remove(...validators: (ValidatorData | ValidatorFn)[]): void;
removeBy(callback: RemoveByCallback): void;
removeById(...ids: any[]): void;
}
enabled: boolean;
get length(): number;
[iterator](): IterableIterator<ValidatorData, any, any>;
add(...validators: (ValidatorData | ValidatorFn)[]): void;
clear(): void;
remove(...validators: (ValidatorData | ValidatorFn)[]): void;
removeBy(callback: RemoveByCallback): void;
removeById(...ids: any[]): void;
}
Index
Accessors
Methods
Accessors
enabled
- get enabled(): boolean
Returns boolean
Returns the enabled state.
- set enabled(enabled): void
Parameters
- enabled: boolean
Sets enabled state.
Returns void
- enabled: boolean
length
- get length(): number
Returns number
Returns the length of the validators array.
Methods
[iterator]
- [iterator](): IterableIterator<ValidatorData, any, any>
Provides an iterator for validators.
Returns IterableIterator<ValidatorData, any, any>
iterator.
add
- add(...validators): void
Adds the given validators.
Parameters
Rest
...validators: (ValidatorData | ValidatorFn)[]Validators to add.
Returns void
clear
remove
- remove(...validators): void
Removes one or more given validators.
Parameters
Rest
...validators: (ValidatorData | ValidatorFn)[]Validators to remove.
Returns void
removeBy
- remove
By (callback): void Remove validators by the provided callback. The callback takes 3 parameters:
id
,validator
, andweight
. Any truthy value returned will remove that validator.Parameters
- callback: RemoveByCallback
Callback function to evaluate each validator entry.
Returns void
- callback: RemoveByCallback
Provides the validator API implementation for TJSPosition.validators. You may add one or more validator functions which evaluate changes in the associated TJSPosition instance. This allows standard validation for browser bounds / transform checking available via TJSPosition.Validators or custom validators added which may provide unique bounding validation / constraints.