From 11cbf729f31e1bb436e6d02dd623d9be02a03c77 Mon Sep 17 00:00:00 2001 From: Peter Klecha Date: Mon, 4 Dec 2023 08:25:14 -0800 Subject: [PATCH] Normative: add `Promise.withResolvers` (#3179) --- spec.html | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/spec.html b/spec.html index 3797be9a62..7930ed6cf4 100644 --- a/spec.html +++ b/spec.html @@ -47029,6 +47029,20 @@

+ +

Promise.withResolvers ( )

+

This function returns an object with three properties: a new promise together with the `resolve` and `reject` functions associated with it.

+ + 1. Let _C_ be the *this* value. + 1. Let _promiseCapability_ be ? NewPromiseCapability(_C_). + 1. Let _obj_ be OrdinaryObjectCreate(%Object.prototype%). + 1. Perform ! CreateDataPropertyOrThrow(_obj_, *"promise"*, _promiseCapability_.[[Promise]]). + 1. Perform ! CreateDataPropertyOrThrow(_obj_, *"resolve"*, _promiseCapability_.[[Resolve]]). + 1. Perform ! CreateDataPropertyOrThrow(_obj_, *"reject"*, _promiseCapability_.[[Reject]]). + 1. Return _obj_. + +
+

get Promise [ @@species ]

`Promise[@@species]` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps when called: