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

    PortPromise extends HsPromise and integrates with a message port for resolving promises. It implements the ITickable interface for periodic updates.

    Type Parameters

    • T

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    • Creates a new PortPromise instance.

      Type Parameters

      • T

      Parameters

      • port: ISGROMessagePort

        The message port to use for resolving the promise.

      • maxMs: number = 30000

        The maximum time in milliseconds to wait for a message before rejecting the promise.

      Returns PortPromise<T>

    Properties

    currentMs: number = 0
    debugTickCount: number = 0
    id: string = ''

    A unique identifier for the promise.

    maxMs: number = 0

    Methods

    • Periodic update method for checking the message port. Resolves the promise when a message is received.

      Parameters

      • Optionaldelta: number

        The time delta since the last update.

      Returns void

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