Class NopePromise<T, E>

A Custom Implementation of Nope-Promise. They are cancelable.

Export

Implements

Type Parameters

  • T

    Type of the Default Promise

  • E = any

    Type of the Cancelation Data.

Hierarchy

  • Promise<T>
    • NopePromise

Implements

Constructors

  • Creates an instance of NopePromise.

    Memberof

    NopePromise

    Type Parameters

    • T

    • E = any

    Parameters

    • executor: ((resolve, reject) => void)
        • (resolve, reject): void
        • Parameters

          • resolve: ((value?) => void)
              • (value?): void
              • Parameters

                • Optional value: T | PromiseLike<T>

                Returns void

          • reject: ((reason?) => void)
              • (reason?): void
              • Parameters

                • Optional reason: any

                Returns void

          Returns void

    • Optional cancel: ((reason) => void)
        • (reason): void
        • Parameters

          • reason: E

          Returns void

    • Optional taskId: string

    Returns NopePromise<T, E>

Properties

[toStringTag]: string
taskId: string

Attribute holding the Task-ID assinged by a dispatcher.

Memberof

NopePromise

[species]: PromiseConstructor

Methods

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

    Returns

    A Promise for the completion of the callback.

    Type Parameters

    • TResult = never

    Parameters

    • Optional onrejected: ((reason) => TResult | PromiseLike<TResult>)

      The callback to execute when the Promise is rejected.

        • (reason): TResult | PromiseLike<TResult>
        • Parameters

          • reason: any

          Returns TResult | PromiseLike<TResult>

    Returns Promise<T | TResult>

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

    Returns

    A Promise for the completion of the callback.

    Parameters

    • Optional onfinally: (() => void)

      The callback to execute when the Promise is settled (fulfilled or rejected).

        • (): void
        • Returns void

    Returns Promise<T>

  • Attaches callbacks for the resolution and/or rejection of the Promise.

    Returns

    A Promise for the completion of which ever callback is executed.

    Type Parameters

    • TResult1 = T

    • TResult2 = never

    Parameters

    • Optional onfulfilled: ((value) => TResult1 | PromiseLike<TResult1>)

      The callback to execute when the Promise is resolved.

        • (value): TResult1 | PromiseLike<TResult1>
        • Parameters

          • value: T

          Returns TResult1 | PromiseLike<TResult1>

    • Optional onrejected: ((reason) => TResult2 | PromiseLike<TResult2>)

      The callback to execute when the Promise is rejected.

        • (reason): TResult2 | PromiseLike<TResult2>
        • Parameters

          • reason: any

          Returns TResult2 | PromiseLike<TResult2>

    Returns Promise<TResult1 | TResult2>

  • Creates a Promise that is resolved with an array of results when all of the provided Promises resolve, or rejected when any Promise is rejected.

    Returns

    A new Promise.

    Type Parameters

    • T

    Parameters

    • values: Iterable<T | PromiseLike<T>>

      An iterable of Promises.

    Returns Promise<Awaited<T>[]>

  • Creates a Promise that is resolved with an array of results when all of the provided Promises resolve, or rejected when any Promise is rejected.

    Returns

    A new Promise.

    Type Parameters

    • T extends [] | readonly unknown[]

    Parameters

    • values: T

      An array of Promises.

    Returns Promise<{
        -readonly [P in string | number | symbol]: Awaited<T[P]>
    }>

  • Creates a Promise that is resolved with an array of results when all of the provided Promises resolve or reject.

    Returns

    A new Promise.

    Type Parameters

    • T extends [] | readonly unknown[]

    Parameters

    • values: T

      An array of Promises.

    Returns Promise<{
        -readonly [P in string | number | symbol]: PromiseSettledResult<Awaited<T[P]>>
    }>

  • Creates a Promise that is resolved with an array of results when all of the provided Promises resolve or reject.

    Returns

    A new Promise.

    Type Parameters

    • T

    Parameters

    • values: Iterable<T | PromiseLike<T>>

      An array of Promises.

    Returns Promise<PromiseSettledResult<Awaited<T>>[]>

  • The any function returns a promise that is fulfilled by the first given promise to be fulfilled, or rejected with an AggregateError containing an array of rejection reasons if all of the given promises are rejected. It resolves all elements of the passed iterable to promises as it runs this algorithm.

    Returns

    A new Promise.

    Type Parameters

    • T extends [] | readonly unknown[]

    Parameters

    • values: T

      An array or iterable of Promises.

    Returns Promise<Awaited<T[number]>>

  • The any function returns a promise that is fulfilled by the first given promise to be fulfilled, or rejected with an AggregateError containing an array of rejection reasons if all of the given promises are rejected. It resolves all elements of the passed iterable to promises as it runs this algorithm.

    Returns

    A new Promise.

    Type Parameters

    • T

    Parameters

    • values: Iterable<T | PromiseLike<T>>

      An array or iterable of Promises.

    Returns Promise<Awaited<T>>

  • Creates a Promise that is resolved or rejected when any of the provided Promises are resolved or rejected.

    Returns

    A new Promise.

    Type Parameters

    • T

    Parameters

    • values: Iterable<T | PromiseLike<T>>

      An iterable of Promises.

    Returns Promise<Awaited<T>>

  • Creates a Promise that is resolved or rejected when any of the provided Promises are resolved or rejected.

    Returns

    A new Promise.

    Type Parameters

    • T extends [] | readonly unknown[]

    Parameters

    • values: T

      An array of Promises.

    Returns Promise<Awaited<T[number]>>

  • Creates a new rejected promise for the provided reason.

    Returns

    A new rejected Promise.

    Type Parameters

    • T = never

    Parameters

    • Optional reason: any

      The reason the promise was rejected.

    Returns Promise<T>

  • Creates a new resolved promise.

    Returns

    A resolved promise.

    Returns Promise<void>

  • Creates a new resolved promise for the provided value.

    Returns

    A promise whose internal state matches the provided promise.

    Type Parameters

    • T

    Parameters

    • value: T

      A promise.

    Returns Promise<Awaited<T>>

  • Creates a new resolved promise for the provided value.

    Returns

    A promise whose internal state matches the provided promise.

    Type Parameters

    • T

    Parameters

    • value: T | PromiseLike<T>

      A promise.

    Returns Promise<Awaited<T>>

Generated using TypeDoc