Function anyExclusive

  • Creates 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. Unlike any, after any of the given promises fulfills an inner prompt or delay, the other promises are forcibly rejected. This is useful for letting players select from a range of actions, where responding to the first prompt of any action commits that player to only that action. Note that you must pass in a function that returns an array of Promises. That function will be invoked once, and only any promises created during invokation will be exclusive. If that function returns promises that were previously created elsewhere, they won't be exclusive.

    Type Parameters

    • T extends [] | readonly unknown[]

    Parameters

    • createPromises: (() => T)

      A function that should return an array or iterable of Promises. The promises should be created inside this function.

        • (): T
        • Returns T

    Returns Promise<Awaited<T[number]>>

    A new Promise.

Generated using TypeDoc