react-waitables
    Preparing search index...

    Interface Waitable<SuccessT, FailureT>

    A state representation for a value or error producing, synchronous or asynchronous, function, which may:

    • have a value or error, or not
    • be complete or incomplete
    • be busy or not
    • be locked or unlocked
    • be waited for
    • be reset, allowing the task to be restarted
    interface Waitable<SuccessT, FailureT = any> {
        error: ReadonlyBinding<undefined | FailureT>;
        force: Binding<undefined | WrappedResult<SuccessT, FailureT>>;
        id: string;
        isBusy: ReadonlyBinding<boolean>;
        isComplete: ReadonlyBinding<boolean>;
        isLocked: ReadonlyBinding<boolean>;
        isLockedWithoutValue: ReadonlyBinding<boolean>;
        isWaitable: true;
        reset: (resetType: ResetType) => void;
        value: ReadonlyBinding<undefined | SuccessT>;
        wait: (options?: WaitOptions) => Promise<WaitResult>;
    }

    Type Parameters

    • SuccessT
    • FailureT = any
    Index

    Properties

    error: ReadonlyBinding<undefined | FailureT>

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

    force: Binding<undefined | WrappedResult<SuccessT, FailureT>>

    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

    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)

    isWaitable: true

    A marker indicating that this is a waitable type

    reset: (resetType: ResetType) => void

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

    Type declaration

      • (resetType: ResetType): void
      • Parameters

        • resetType: ResetType

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

        Returns void

    value: ReadonlyBinding<undefined | SuccessT>

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

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

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