Interface UseWaitableArgs<SuccessT, FailureT, ExtraFieldsT>

interface UseWaitableArgs<SuccessT, FailureT, ExtraFieldsT> {
    addFields?: ((thisWaitable) => ExtraFieldsT);
    areErrorsEqual?: ((a, b) => boolean);
    areValuesEqual?: ((a, b) => boolean);
    defaultValue?: "use-primary-function-if-unlocked" | UseWaitableDefaultValueProducer<SuccessT> | "use-primary-function";
    deps?: DependencyList;
    detectErrorChanges?: boolean;
    detectValueChanges?: boolean;
    hardResetBindings?: ReadonlyBinding<any> | BindingArrayDependencies;
    id: string;
    limitMSec?: number;
    limitMode?: LimitMode;
    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) => ExtraFieldsT)

Use to support injecting additional fields into bindings

Type declaration

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

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

Type declaration

    • (a, b): boolean
    • If specified, overrides the function used to compare error values.

      Parameters

      • a: any
      • b: any

      Returns boolean

      See

      react-bindings

      Default Value

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

See

react-bindings

Default Value

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

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

If specified, overrides the function used to compare values.

Type declaration

    • (a, b): boolean
    • If specified, overrides the function used to compare values.

      Parameters

      • a: any
      • b: any

      Returns boolean

      See

      react-bindings

      Default Value

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

See

react-bindings

Default Value

_.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.

Default Value

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.

Default Value

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

limitMSec?: number

The duration to debounce/throttle for

Default Value

0

limitMode?: LimitMode

The limiter mode

Default Value

'trailing'

limitType?: LimitType

The type of limiter

Default Value

'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 Value

DEFAULT_PRIORITY (0)

queue?: RunQueue

The queue

Default Value

result of useDefaultQueue()

softResetBindings?: ReadonlyBinding<any> | BindingArrayDependencies

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

Generated using TypeDoc