From 278df0d9368d590fdd19843ec63674c252665313 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Thu, 29 Aug 2019 08:17:49 +0200 Subject: [PATCH] Meta: IDL now defines the necessary operations No longer export various promise-related operations as IDL is now the source of truth. Closes #27. --- index.bs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/index.bs b/index.bs index a337e31..49e8de7 100644 --- a/index.bs +++ b/index.bs @@ -210,27 +210,27 @@ When writing such specifications, it's convenient to be able to refer to common

Creating Promises

-"A new promise" gives a new, initialized-but-unresolved promise object to manipulate further. It is equivalent to calling new Promise((resolve, reject) => { ... }), using the initial value of the Promise constructor. Here ... stands in for code that saves the value of resolve and reject for later use by the shorthands under [[#shorthand-manipulating]]. +"A new promise" gives a new, initialized-but-unresolved promise object to manipulate further. It is equivalent to calling new Promise((resolve, reject) => { ... }), using the initial value of the Promise constructor. Here ... stands in for code that saves the value of resolve and reject for later use by the shorthands under [[#shorthand-manipulating]]. -"A promise resolved with x" or "x resolved as a promise" is shorthand for the result of Promise.resolve(x), using the initial value of Promise.resolve. +"A promise resolved with x" or "x resolved as a promise" is shorthand for the result of Promise.resolve(x), using the initial value of Promise.resolve. -"A promise rejected with r" is shorthand for the result of Promise.reject(r), using the initial value of Promise.reject. +"A promise rejected with r" is shorthand for the result of Promise.reject(r), using the initial value of Promise.reject.

Manipulating Promises

-"Resolve p with x" is shorthand for calling a previously-stored resolve function from creating p, with argument x. +"Resolve p with x" is shorthand for calling a previously-stored resolve function from creating p, with argument x. -"Reject p with r" is shorthand for calling a previously-stored reject function from creating p, with argument r. +"Reject p with r" is shorthand for calling a previously-stored reject function from creating p, with argument r. If the algorithm using these shorthands is running in parallel, the shorthands queue a task on p's relevant settings object's responsible event loop to call the stored function.

Reacting to Promises

-"Upon fulfillment of p with value v" is shorthand for calling p.then(onFulfilled), with the successive nested steps comprising the onFulfilled function, and using the initial value of Promise.prototype.then. The steps then have access to onFulfilled's argument as v. +"Upon fulfillment of p with value v" is shorthand for calling p.then(onFulfilled), with the successive nested steps comprising the onFulfilled function, and using the initial value of Promise.prototype.then. The steps then have access to onFulfilled's argument as v. -"Upon rejection of p with reason r" is shorthand for calling p.then(undefined, onRejected), with the successive nested steps comprising the onRejected function, and using the initial value of Promise.prototype.then. The steps then have access to onRejected's argument as r. +"Upon rejection of p with reason r" is shorthand for calling p.then(undefined, onRejected), with the successive nested steps comprising the onRejected function, and using the initial value of Promise.prototype.then. The steps then have access to onRejected's argument as r. -"Transforming p with a fulfillment and/or rejection handler" is shorthand for calling p.then(fulfillmentHandler, rejectionHandler), using the initial value of Promise.prototype.then. +"Transforming p with a fulfillment and/or rejection handler" is shorthand for calling p.then(fulfillmentHandler, rejectionHandler), using the initial value of Promise.prototype.then.
Some examples of the latter phrase would be @@ -258,7 +258,7 @@ If the algorithm using these shorthands is running in parallel, the short

Aggregating Promises

-To wait for all of a list of promises |promises|, with success steps |successSteps| that take a list of JavaScript values and failure steps |failureSteps| that take a rejection reason JavaScript value, perform the following steps: +To wait for all of a list of promises |promises|, with success steps |successSteps| that take a list of JavaScript values and failure steps |failureSteps| that take a rejection reason JavaScript value, perform the following steps: 1. Let |fullfilledCount| be 0. 1. Let |rejected| be false. @@ -283,7 +283,7 @@ To wait for a This phrase is useful when you wish to aggregate the result of multiple promises, and react to them all together, in the same way that {{Promise/all()|Promise.all()}} functions for JavaScript code. -To get a promise for waiting for all of a list of promises |promises|, with success steps |successSteps| that take a list of JavaScript values and optional failure steps |failureSteps| that take a rejection reason JavaScript value, perform the following steps: +To get a promise for waiting for all of a list of promises |promises|, with success steps |successSteps| that take a list of JavaScript values and optional failure steps |failureSteps| that take a rejection reason JavaScript value, perform the following steps: 1. Let |promise| be a new promise. 1. If |failureSteps| were not given, let them be steps taking an argument |arg| that throw |arg|. @@ -302,7 +302,7 @@ An example usage of this phrase is found in [[#example-batch-request]].

Promise-Calling

-The result of promise-calling f(...args) is: +The result of promise-calling f(...args) is: - If the call returns a value v, the result of resolving v as a promise. - If the call throws an exception e, a promise rejected with e.