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.

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;
}

Accessors

  • get enabled(): boolean
  • Returns boolean

    Returns the enabled state.

  • set enabled(enabled): void
  • Parameters

    • enabled: boolean

      Sets enabled state.

    Returns void

  • get length(): number
  • Returns number

    Returns the length of the validators array.

Methods

  • Adds the given validators.

    Parameters

    Returns void

  • Clears / removes all validators.

    Returns void

  • Removes one or more given validators.

    Parameters

    Returns void

  • Remove validators by the provided callback. The callback takes 3 parameters: id, validator, and weight. Any truthy value returned will remove that validator.

    Parameters

    Returns void

  • Removes any validators with matching IDs.

    Parameters

    • Rest...ids: any[]

      IDs to remove.

    Returns void