react-waitables
    Preparing search index...

    Type Alias WaitablePrimaryFunction<SuccessT, FailureT>

    WaitablePrimaryFunction: (
        args: {
            setFailure: (value: FailureT) => boolean;
            setSuccess: (value: SuccessT | undefined) => boolean;
            wasReset: () => boolean;
        },
    ) => TypeOrPromisedType<void>

    Type Parameters

    • SuccessT
    • FailureT = any

    Type declaration

      • (
            args: {
                setFailure: (value: FailureT) => boolean;
                setSuccess: (value: SuccessT | undefined) => boolean;
                wasReset: () => boolean;
            },
        ): TypeOrPromisedType<void>
      • Parameters

        • args: {
              setFailure: (value: FailureT) => boolean;
              setSuccess: (value: SuccessT | undefined) => boolean;
              wasReset: () => boolean;
          }
          • setFailure: (value: FailureT) => boolean

            Call to set the waitable's error.

            Calling setFailure more than once and/or after a setSuccess call is allowed and will make the waitable fail with the specified error. This also triggers handlers for the isComplete binding, even if isComplete is already true.

          • setSuccess: (value: SuccessT | undefined) => boolean

            Call to set the waitable's value.

            Calling setSuccess with an undefined value marks the waitable as no longer busy but still incomplete. To rerun the primary function, reset must be used.

            Calling setSuccess more than once and/or after a setFailure call is allowed and will make the waitable successful with the specified value. This also triggers handlers for the isComplete binding, even if isComplete is already true.

          • wasReset: () => boolean

            Determines if the waitable was reset after the setSuccess or setFailure were created. If it was reset, calls to these functions will be ignored. However, proactively checking can help some asynchronous functions avoid unnecessary work, even if they're already partially complete.

        Returns TypeOrPromisedType<void>