@zeroc/ice
    Preparing search index...

    Class AsyncResult<T>Abstract

    The AsyncResult class encapsulates the state of an asynchronous invocation. It extends the Promise class. It provides additional methods to support canceling the operation.

    Type Parameters

    • T

    Hierarchy (View Summary)

    Index

    Constructors

    • Constructs a new promise.

      Type Parameters

      • T

      Parameters

      • Optionalexecutor: (
            resolve: (value: T | PromiseLike<T>) => void,
            reject: (reason: any) => void,
        ) => void

        The executor function that is called immediately when the promise is constructed. It is passed two functions, resolve and reject, that can be called to resolve or reject the promise respectively.

      Returns AsyncResult<T>

    Properties

    "[toStringTag]": string
    communicator: Communicator

    The communicator associated with the asynchronous operation.

    operation: string

    The operation name.

    proxy: ObjectPrx

    The object proxy associated with the invocation.

    "[species]": PromiseConstructor

    Methods

    • Cancels the asynchronous request.

      Returns void

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

      Type Parameters

      • TResult = never

      Parameters

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

        The callback to execute when the Promise is rejected.

      Returns Promise<T | TResult>

      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: () => void

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

      Returns Promise<T>

      A Promise for the completion of the callback.

    • Whether the asynchronous request has completed.

      Returns boolean

      true if the asynchronous request has completed, false otherwise.

    • Whether the asynchronous request has been sent.

      Returns boolean

      true if the asynchronous request has been sent, false otherwise.

    • Rejects the promise with the specified reason.

      Parameters

      • reason: any

        The reason for rejecting the promise.

      Returns void

    • Resolves the promise with the specified value.

      Type Parameters

      • T

      Parameters

      • Optionalvalue: T | PromiseLike<T>

        The value to resolve the promise with.

      Returns void

    • Whether the asynchronous request has been sent synchronously.

      Returns boolean

      true if the asynchronous request has been sent synchronously, false otherwise.

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

      Type Parameters

      • TResult1 = T
      • TResult2 = never

      Parameters

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

        The callback to execute when the Promise is resolved.

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

        The callback to execute when the Promise is rejected.

      Returns Promise<TResult1 | TResult2>

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

    • Throws the exception if the asynchronous request was rejected with one; otherwise, does nothing.

      Returns void

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

      Type Parameters

      • T

      Parameters

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

        An iterable of Promises.

      Returns Promise<Awaited<T>[]>

      A new Promise.

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

      Type Parameters

      • T extends [] | readonly unknown[]

      Parameters

      • values: T

        An array of Promises.

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

      A new Promise.

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

      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<P>]>>
          },
      >

      A new Promise.

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

      Type Parameters

      • T

      Parameters

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

        An array of Promises.

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

      A new Promise.

    • Returns a promise that is resolved after a specified delay.

      Parameters

      • ms: number

        The number of milliseconds to delay.

      Returns Promise<void>

      A promise that is resolved after the specified delay.

    • Returns a promise that is resolved after a specified delay with a specified value.

      Type Parameters

      • T

      Parameters

      • ms: number

        The number of milliseconds to delay.

      • value: T

        The value to resolve the promise with.

      Returns Promise<T>

      A promise that is resolved after the specified delay with the specified value.

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

      Type Parameters

      • T

      Parameters

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

        An iterable of Promises.

      Returns Promise<Awaited<T>>

      A new Promise.

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

      Type Parameters

      • T extends [] | readonly unknown[]

      Parameters

      • values: T

        An array of Promises.

      Returns Promise<Awaited<T[number]>>

      A new Promise.

    • Creates a new rejected promise for the provided reason.

      Type Parameters

      • T = never

      Parameters

      • Optionalreason: any

        The reason the promise was rejected.

      Returns Promise<T>

      A new rejected Promise.

    • Creates a new resolved promise.

      Returns Promise<void>

      A resolved promise.

    • Creates a new resolved promise for the provided value.

      Type Parameters

      • T

      Parameters

      • value: T

        A promise.

      Returns Promise<Awaited<T>>

      A promise whose internal state matches the provided promise.

    • Creates a new resolved promise for the provided value.

      Type Parameters

      • T

      Parameters

      • value: T | PromiseLike<T>

        A promise.

      Returns Promise<Awaited<T>>

      A promise whose internal state matches the provided promise.