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 Oct 15, 2024
1 parent 6b4217b commit 6ba853a
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 @@ -47588,6 +47588,25 @@ <h1>
</emu-clause>
</emu-clause>

<emu-clause id="sec-promise.try">
<h1>Promise.try ( _callback_, ..._args_ )</h1>
<p>When the `try` method is called with argument _callback_, 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(_callback_, *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 6ba853a

Please sign in to comment.