Skip to content

Commit d72630f

Browse files
committed
Normative: add Promise.try (#3327)
See tc39/proposal-promise-try#15
1 parent 1c4ba24 commit d72630f

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

spec.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47588,6 +47588,25 @@ <h1>
4758847588
</emu-clause>
4758947589
</emu-clause>
4759047590

47591+
<emu-clause id="sec-promise.try">
47592+
<h1>Promise.try ( _callback_, ..._args_ )</h1>
47593+
<p>When the `try` method is called with argument _callback_, the following steps are taken:</p>
47594+
<emu-alg>
47595+
1. Let _C_ be the *this* value.
47596+
1. If _C_ is not an Object, throw a *TypeError* exception.
47597+
1. Let _promiseCapability_ be ? NewPromiseCapability(_C_).
47598+
1. Let _status_ be Completion(Call(_callback_, *undefined*, _args_)).
47599+
1. If _status_ is an abrupt completion, then
47600+
1. Perform ? Call(_promiseCapability_.[[Reject]], *undefined*, « _status_.[[Value]] »).
47601+
1. Else,
47602+
1. Perform ? Call(_promiseCapability_.[[Resolve]], *undefined*, « _status_.[[Value]] »).
47603+
1. Return _promiseCapability_.[[Promise]].
47604+
</emu-alg>
47605+
<emu-note>
47606+
<p>This function expects its *this* value to be a constructor function that supports the parameter conventions of the Promise constructor.</p>
47607+
</emu-note>
47608+
</emu-clause>
47609+
4759147610
<emu-clause id="sec-promise.withResolvers">
4759247611
<h1>Promise.withResolvers ( )</h1>
4759347612
<p>This function returns an object with three properties: a new promise together with the `resolve` and `reject` functions associated with it.</p>

0 commit comments

Comments
 (0)