Class RnPromise<T>

Extended Promise class that provides additional functionality including progress callbacks for Promise.all operations. This class wraps the native Promise and adds monitoring capabilities for batch promise operations.

Type Parameters

  • T

    The type of the resolved value

Hierarchy

  • Promise<T>
    • RnPromise

Constructors

Properties

Methods

Constructors

Properties

name: string = ''

Methods

  • Attaches a callback for only the rejection of the Promise.

    Parameters

    • OptionalonRejected: any

      The callback to execute when the Promise is rejected

    Returns RnPromise<T>

    A Promise for the completion of the callback

  • Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The resolved value cannot be modified from the callback.

    Parameters

    • OptionalonFinally: OnFinallyFn

      The callback to execute when the Promise is settled

    Returns Promise<T>

    A Promise for the completion of the callback

  • Attaches callbacks for the resolution and/or rejection of the Promise. This method also handles progress tracking when used with Promise.all and a callback.

    Type Parameters

    • TResult1 = T
    • TResult2 = never

    Parameters

    • Optionalonfulfilled: null | ((value: T) => TResult1 | PromiseLike<TResult1>)

      The callback to execute when the Promise is resolved

    • Optionalonrejected: null | ((reason: any) => TResult2 | PromiseLike<TResult2>)

      The callback to execute when the Promise is rejected

    Returns RnPromise<TResult1 | TResult2>

    A Promise for the completion of which ever callback is executed

  • Creates a Promise that resolves when all input promises resolve, with optional progress callback. The callback function is called whenever a promise in the array resolves or rejects, providing real-time progress information.

    Parameters

    • promises: any[]

      Array of promises to wait for

    • Optionalcallback: RnPromiseCallback

      Optional callback function to monitor progress

    Returns RnPromise<any[]>

    A Promise that resolves with an array of all resolved values

  • Creates a Promise that resolves or rejects as soon as one of the input promises resolves or rejects.

    Parameters

    • args: any[]

      Array of promises to race

    Returns RnPromise<any>

    A Promise that resolves or rejects with the value/reason of the first settled promise

  • Creates a resolved RnPromise with no value

    Type Parameters

    • T

    Returns Promise<T>

    A resolved Promise

  • Creates a resolved RnPromise with the given value

    Type Parameters

    • T

    Parameters

    • arg: T | PromiseLike<T>

      The value or Promise-like object to resolve with

    Returns Promise<T>

    A resolved Promise