Interface UseWaitableArgs<SuccessT, FailureT, ExtraFieldsT>

interface UseWaitableArgs<SuccessT, FailureT, ExtraFieldsT> {
    addFields?: ((thisWaitable: Waitable<SuccessT, FailureT>) => ExtraFieldsT);
    areErrorsEqual?: ((a: any, b: any) => boolean);
    areValuesEqual?: ((a: any, b: any) => boolean);
    defaultValue?: "use-primary-function-if-unlocked" | UseWaitableDefaultValueProducer<SuccessT> | "use-primary-function";
    deps?: DependencyList;
    detectErrorChanges?: boolean;
    detectValueChanges?: boolean;
    hardResetBindings?: ReadonlyBinding<any> | BindingArrayDependencies;
    id: string;
    limitMode?: LimitMode;
    limitMSec?: number;
    limitType?: LimitType;
    lockedUntil?: ReadonlyBinding<any> | BindingArrayDependencies;
    lockedWhile?: ReadonlyBinding<any> | BindingArrayDependencies;
    onFailure?: UseWaitableOnFailureCallback<FailureT>;
    onReset?: UseWaitableOnResetCallback;
    onSuccess?: UseWaitableOnSuccessCallback<SuccessT>;
    priority?: number;
    queue?: RunQueue;
    softResetBindings?: ReadonlyBinding<any> | BindingArrayDependencies;
}

Type Parameters

  • SuccessT
  • FailureT = any
  • ExtraFieldsT extends object = EmptyObject

Hierarchy

  • LimiterOptions
    • UseWaitableArgs

Properties

addFields?: ((thisWaitable: Waitable<SuccessT, FailureT>) => ExtraFieldsT)

Use to support injecting additional fields into bindings

areErrorsEqual?: ((a: any, b: any) => boolean)

If specified, overrides the function used to compare error values.

react-bindings

_.isEqual, which can be globally overridden using react-bindings setAreEqual

areValuesEqual?: ((a: any, b: any) => boolean)

If specified, overrides the function used to compare values.

react-bindings

_.isEqual, which can be globally overridden using react-bindings setAreEqual

defaultValue?: "use-primary-function-if-unlocked" | UseWaitableDefaultValueProducer<SuccessT> | "use-primary-function"

This can be used to generate a default value, which will be used to initialize the value and whenever this waitable is hard reset. You may alternatively, specify 'use-primary-function' or 'use-primary-function-if-unlocked', in which case the primary function will be called immediately on initialization or reset.

deps?: DependencyList

On a rerender, deps changes are treated like hard reset bindings changes.

detectErrorChanges?: boolean
  • If trueareErrorsEqual is used to compare the old and new error values. If the values are equal, the error binding's underlying value won't be changed.
  • If false – old and new values aren't compared and the error binding's underlying value will always be updated.

true

detectValueChanges?: boolean
  • If trueareErrorsEqual is used to compare the old and new values. If the values are equal, the value binding's underlying value won't be changed.
  • If false – old and new values aren't compared and the value binding's underlying value will always be updated.

true

hardResetBindings?: ReadonlyBinding<any> | BindingArrayDependencies

If any of these bindings change, the waitable will be hard reset

id: string

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

limitMode?: LimitMode

The limiter mode

'trailing'

limitMSec?: number

The duration to debounce/throttle for

0

limitType?: LimitType

The type of limiter

'debounce'

lockedUntil?: ReadonlyBinding<any> | BindingArrayDependencies

If specified and the values of any of the specified bindings are not truthy, the waitable is locked and the primary function cannot be run yet

lockedWhile?: ReadonlyBinding<any> | BindingArrayDependencies

If specified and the values of any of the specified bindings are truthy, the waitable is locked and the primary function cannot be run yet

Called each time setFailure is called (except if the call to setFailure is ignored, ex. due to a reset or when an error occurs when computing a default value)

Called each time this waitable is reset

Called each time setSuccess is called (except if the call to setSuccess is ignored, ex. due to a reset)

priority?: number

The priority

DEFAULT_PRIORITY (0)

queue?: RunQueue

The queue

result of useDefaultQueue()

softResetBindings?: ReadonlyBinding<any> | BindingArrayDependencies

If any of these bindings change, the waitable will be soft reset