Skip to content

Commit

Permalink
Normative: add Promise.try (#3327)
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed May 14, 2024
1 parent 705742e commit 6562a42
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -46990,6 +46990,25 @@ <h1>
</emu-clause>
</emu-clause>

<emu-clause id="sec-promise.try">
<h1>Promise.try ( _callbackfn_, ..._args_ )</h1>
<p>When the `try` method is called with argument _callbackfn_, the following steps are taken:</p>
<emu-alg>
1. Let _C_ be the *this* value.
1. If _C_ is not an Object, throw a *TypeError* exception.
1. Let _promiseCapability_ be ? NewPromiseCapability(_C_).
1. Let _status_ be Completion(Call(_callbackfn_, *undefined*, _args_)).
1. If _status_ is an abrupt completion, then
1. Perform ? Call(_promiseCapability_.[[Reject]], *undefined*, « _status_.[[Value]] »).
1. Else,
1. Perform ? Call(_promiseCapability_.[[Resolve]], *undefined*, « _status_.[[Value]] »).
1. Return _promiseCapability_.[[Promise]].
</emu-alg>
<emu-note>
<p>This function expects its *this* value to be a constructor function that supports the parameter conventions of the Promise constructor.</p>
</emu-note>
</emu-clause>

<emu-clause id="sec-promise.withResolvers">
<h1>Promise.withResolvers ( )</h1>
<p>This function returns an object with three properties: a new promise together with the `resolve` and `reject` functions associated with it.</p>
Expand Down

0 comments on commit 6562a42

Please sign in to comment.