Hosanna UI API v1.30.2-next
    Preparing search index...

    HsPromise is a custom implementation of a promise-like object. It provides methods for handling asynchronous operations, including then, catch, and finally.

    Type Parameters

    • T

    Hierarchy (View Summary)

    Index

    Constructors

    • Creates a new HsPromise instance.

      Type Parameters

      • T

      Parameters

      • Optionalexecutor: (resolve: (value?: T) => void, reject: (reason?: any) => void) => void

        A function that is executed immediately, with resolve and reject callbacks.

      Returns HsPromise<T>

    Methods

    • Attaches a callback for when the promise is rejected.

      Parameters

      • OptionalonRejected: (reason: any) => T | HsPromise<T>

        A callback to execute when the promise is rejected.

      Returns HsPromise<T>

      A new HsPromise that resolves or rejects based on the provided callback.

    • Attaches a callback that is executed when the promise is settled, regardless of its outcome.

      Parameters

      • callback: () => void

        A callback to execute when the promise is settled.

      Returns HsPromise<T>

      A new HsPromise that resolves or rejects based on the original promise.

    • Rejects the promise with the specified reason.

      Parameters

      • Optionalreason: any

        The reason for rejecting the promise.

      Returns void

    • Resolves the promise with the specified value.

      Parameters

      • Optionalvalue: T

        The value to resolve the promise with.

      Returns void

    • Returns a promise that fulfills with an array of results when all input promises fulfill. Rejects if any one rejects.

      Type Parameters

      • T extends readonly unknown[]

      Parameters

      • values: T

        An iterable (array) of promises or values.

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

      A promise that resolves with an array of results, or rejects if any input rejects.

    • Returns a promise that fulfills with an array of objects describing the outcome of each input promise, regardless of whether they fulfilled or rejected.

      Type Parameters

      • T extends readonly unknown[]

      Parameters

      • values: T

        An iterable (array) of promises or values.

      Returns HsPromise<PromiseSettledResult<Awaited<T[number]>>[]>

      A promise that always resolves with an array of settlement results.

    • Returns a promise that fulfills with the first fulfilled input promise. Rejects with an AggregateError if all promises reject (or if the array is empty).

      Type Parameters

      • T extends readonly unknown[]

      Parameters

      • values: T

        An iterable (array) of promises or values.

      Returns HsPromise<Awaited<T[number]>>

      A promise that resolves with the first fulfilled value, or rejects if all reject.

    • Returns a promise that settles (fulfills or rejects) as soon as the first input promise settles.

      Type Parameters

      • T extends readonly unknown[]

      Parameters

      • values: T

        An iterable (array) of promises or values.

      Returns HsPromise<Awaited<T[number]>>

      A promise that settles with the first settled input promise.

    • Returns a promise that is rejected with the given reason.

      Type Parameters

      • T = never

      Parameters

      • Optionalreason: any

        The reason for rejecting the promise.

      Returns HsPromise<T>

      A promise rejected with the given reason.

    • Returns a promise that is fulfilled with the given value. If the value is already an HsPromise, it is returned directly.

      Type Parameters

      • T

      Parameters

      • Optionalvalue: T | HsPromise<T>

        The value to resolve the promise with, or an existing HsPromise.

      Returns HsPromise<T>

      A promise resolved with the given value.

    • Returns an object with a promise and its resolve/reject functions. This method is not supported in HsPromise.

      Type Parameters

      • T

      Returns {
          promise: HsPromise<T>;
          reject: (reason?: any) => void;
          resolve: (value: T) => void;
      }

      Error indicating that withResolvers is not supported.