Interface Validator

A validator is a waitable that produces a ValidationResult, indicating either validity or a problem, if all of its dependencies are loaded (or if the validator is disabled).

interface Validator {
    error: ReadonlyBinding<any>;
    force: Binding<undefined | WrappedResult<ValidationResult, any>>;
    id: string;
    isBusy: ReadonlyBinding<boolean>;
    isComplete: ReadonlyBinding<boolean>;
    isDisabled: (() => boolean);
    isLocked: ReadonlyBinding<boolean>;
    isLockedWithoutValue: ReadonlyBinding<boolean>;
    isValidator: true;
    isWaitable: true;
    reset: ((resetType) => void);
    setDisabledOverride: ((disabled) => void);
    setIsFinalizing: ((isFinalizing) => void);
    value: ReadonlyBinding<undefined | ValidationResult>;
    wait: ((options?) => Promise<WaitResult>);
}

Hierarchy

Properties

error: ReadonlyBinding<any>

The failure value or undefined if either incomplete or completed successfully.

force: Binding<undefined | WrappedResult<ValidationResult, any>>

This can be used to force the waitable to have a specified value or error -- usually for testing.

id: string

A technical, but human-readable ID, which isn't guaranteed to be unique

isBusy: ReadonlyBinding<boolean>

If true, the primary function is being run / waited for

isComplete: ReadonlyBinding<boolean>

If true, either the value or error have a defined value

isDisabled: (() => boolean)

Returns true if the validator is disabled, in which case it will always result in "validity"

Type declaration

    • (): boolean
    • Returns true if the validator is disabled, in which case it will always result in "validity"

      Returns boolean

isLocked: ReadonlyBinding<boolean>

If true, this waitable is locked and the primary function won't be started

isLockedWithoutValue: ReadonlyBinding<boolean>

If true, the waitable is locked and doesn't already have a value (ex. from a default value)

isValidator: true

A marker indicating that this is a validator type

isWaitable: true

A marker indicating that this is a waitable type

reset: ((resetType) => void)

Resets the waitable so that the primary function can run again.

Type declaration

    • (resetType): void
    • Resets the waitable so that the primary function can run again.

      Parameters

      • resetType: ResetType

        If 'soft', current values are kept (though errors are cleared). If 'hard', both current value and errors are cleared.

      Returns void

Param: resetType

If 'soft', current values are kept (though errors are cleared). If 'hard', both current value and errors are cleared.

setDisabledOverride: ((disabled) => void)

Overrides the automatically-calculated disabled state of this validator, which is normally based on disabledUntil, disabledWhile, and/or disabledWhileUnmodified.

Setting a defined value overrides. Setting undefined, clears the override, going back to the calculated state.

Type declaration

    • (disabled): void
    • Overrides the automatically-calculated disabled state of this validator, which is normally based on disabledUntil, disabledWhile, and/or disabledWhileUnmodified.

      Setting a defined value overrides. Setting undefined, clears the override, going back to the calculated state.

      Parameters

      • disabled: undefined | boolean

      Returns void

setIsFinalizing: ((isFinalizing) => void)

Sets the validator as currently finalizing or not

Type declaration

    • (isFinalizing): void
    • Sets the validator as currently finalizing or not

      Parameters

      • isFinalizing: boolean

      Returns void

value: ReadonlyBinding<undefined | ValidationResult>

The success value or undefined if either incomplete or an error occurred.

wait: ((options?) => Promise<WaitResult>)

Returns a promise that resolves when the waitable is complete or reset or when this call times out

Type declaration

    • (options?): Promise<WaitResult>
    • Returns a promise that resolves when the waitable is complete or reset or when this call times out

      Parameters

      • Optional options: WaitOptions

      Returns Promise<WaitResult>

Generated using TypeDoc