Stage 1 Draft / September 9, 2025

Await Dictionary

1 Promise.allKeyed ( promises )

This method performs the following steps when called:

  1. Let C be the this value.
  2. Let promiseCapability be ? NewPromiseCapability(C).
  3. Let promiseResolve be Completion(GetPromiseResolve(C)).
  4. IfAbruptRejectPromise(promiseResolve, promiseCapability).
  5. If promises is not an Object, then
    1. Let error be a newly created TypeError object.
    2. Perform ? Call(promiseCapability.[[Reject]], undefined, « error »).
    3. Return promiseCapability.[[Promise]].
  6. Let result be Completion(PerformPromiseAllKeyed(promises, C, promiseCapability, promiseResolve)).
  7. IfAbruptRejectPromise(result, promiseCapability).
  8. Return promiseCapability.[[Promise]].
Note

This function requires its this value to be a constructor function that supports the parameter conventions of the Promise constructor.

1.1 PerformPromiseAllKeyed ( promises, constructor, resultCapability, promiseResolve )

The abstract operation PerformPromiseAllKeyed takes arguments promises (an Object), constructor (a constructor), resultCapability (a PromiseCapability Record), and promiseResolve (a function object) and returns either a normal completion containing an ECMAScript language value or a throw completion. It performs the following steps when called:

  1. Let allKeys be ? promises.[[OwnPropertyKeys]]().
  2. Let keys be a new empty List.
  3. Let values be a new empty List.
  4. Let remainingElementsCount be the Record { [[Value]]: 1 }.
  5. Let index be 0.
  6. For each element key of allKeys, do
    1. Let desc be ? promises.[[GetOwnProperty]](key).
    2. If desc is not undefined and desc.[[Enumerable]] is true, then
      1. Let value be ? Get(promises, key).
      2. Append key to keys.
      3. Append undefined to values.
      4. Let nextPromise be ? Call(promiseResolve, constructor, « value »).
      5. Let steps be the algorithm steps defined in Promise.allKeyed Resolve Element Functions.
      6. Let length be the number of non-optional parameters of the function definition in Promise.allKeyed Resolve Element Functions.
      7. Let onFulfilled be CreateBuiltinFunction(steps, length, "", « [[AlreadyCalled]], [[Index]], [[Keys]], [[Values]], [[Capability]], [[RemainingElements]] »).
      8. Set onFulfilled.[[AlreadyCalled]] to false.
      9. Set onFulfilled.[[Index]] to index.
      10. Set onFulfilled.[[Keys]] to keys.
      11. Set onFulfilled.[[Values]] to values.
      12. Set onFulfilled.[[Capability]] to resultCapability.
      13. Set onFulfilled.[[RemainingElements]] to remainingElementsCount.
      14. Set remainingElementsCount.[[Value]] to remainingElementsCount.[[Value]] + 1.
      15. Perform ? Invoke(nextPromise, "then", « onFulfilled, resultCapability.[[Reject]] »).
      16. Set index to index + 1.
  7. Set remainingElementsCount.[[Value]] to remainingElementsCount.[[Value]] - 1.
  8. If remainingElementsCount.[[Value]] = 0, then
    1. Let result be OrdinaryObjectCreate(null).
    2. Perform ? Call(resultCapability.[[Resolve]], undefined, « result »).
  9. Return resultCapability.[[Promise]].

1.2 Promise.allKeyed Resolve Element Functions

A Promise.all resolve element function is an anonymous built-in function

When a Promise.allKeyed resolve element function is called with argument x, the following steps are taken:

  1. Let F be the active function object.
  2. If F.[[AlreadyCalled]] is true, return undefined.
  3. Set F.[[AlreadyCalled]] to true.
  4. Let index be F.[[Index]].
  5. Let keys be F.[[Keys]].
  6. Let values be F.[[Values]].
  7. Let promiseCapability be F.[[Capability]].
  8. Let remainingElementsCount be F.[[RemainingElements]].
  9. Set values[index] to x.
  10. Set remainingElementsCount.[[Value]] to remainingElementsCount.[[Value]] - 1.
  11. If remainingElementsCount.[[Value]] = 0, then
    1. Let result be OrdinaryObjectCreate(null).
    2. For each integer i such that 0 ≤ i < the number of elements in keys, in ascending order, do
      1. Perform ! CreateDataPropertyOrThrow(result, keys[i], values[i]).
    3. Return ? Call(promiseCapability.[[Resolve]], undefined, « result »).
  12. Return undefined.

Copyright & Software License

Software License

All Software contained in this document ("Software") is protected by copyright and is being made available under the "BSD License", included below. This Software may be subject to third party rights (rights from parties other than Ecma International), including patent rights, and no licenses under such third party rights are granted under this license even if the third party concerned is a member of Ecma International. SEE THE ECMA CODE OF CONDUCT IN PATENT MATTERS AVAILABLE AT https://ecma-international.org/memento/codeofconduct.htm FOR INFORMATION REGARDING THE LICENSING OF PATENT CLAIMS THAT ARE REQUIRED TO IMPLEMENT ECMA INTERNATIONAL STANDARDS.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of the authors nor Ecma International may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE ECMA INTERNATIONAL "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ECMA INTERNATIONAL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.