Interface ValidatorAPI
interface ValidatorAPI {
get enabled(): boolean;
set enabled(enabled: boolean): void;
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;
}
get enabled(): boolean;
set enabled(enabled: boolean): void;
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: boolean): 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: (ValidatorData | ValidatorFn)[]): void
Adds the given validators.
Parameters
- ...validators: (ValidatorData | ValidatorFn)[]
Validators to add.
Returns void
- ...validators: (ValidatorData | ValidatorFn)[]
clear
remove
- remove(...validators: (ValidatorData | ValidatorFn)[]): void
Removes one or more given validators.
Parameters
- ...validators: (ValidatorData | ValidatorFn)[]
Validators to remove.
Returns void
- ...validators: (ValidatorData | ValidatorFn)[]
removeBy
- removeBy(callback: RemoveByCallback): 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.