Skip to content
This repository was archived by the owner on Oct 9, 2024. It is now read-only.

Commit 2f1c94b

Browse files
committed
[spec] accept optional arguments to pass to the callback
Fixes #9
1 parent e804662 commit 2f1c94b

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,7 +1554,7 @@
15541554
});
15551555
15561556
let sdoMap = JSON.parse(`{}`);
1557-
let biblio = JSON.parse(`{"refsByClause":{},"entries":[{"type":"clause","id":"sec-promise.try","title":"Promise.try ( callbackfn )","titleHTML":"Promise.try ( <var>callbackfn</var> )","number":"1"},{"type":"clause","id":"sec-copyright-and-software-license","title":"Copyright & Software License","titleHTML":"Copyright &amp; Software License","number":"A"}]}`);
1557+
let biblio = JSON.parse(`{"refsByClause":{},"entries":[{"type":"clause","id":"sec-promise.try","title":"Promise.try ( callbackfn, ...args )","titleHTML":"Promise.try ( <var>callbackfn</var>, ...<var>args</var> )","number":"1"},{"type":"clause","id":"sec-copyright-and-software-license","title":"Copyright & Software License","titleHTML":"Copyright &amp; Software License","number":"A"}]}`);
15581558
;let usesMultipage = false</script><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.0.1/styles/base16/solarized-light.min.css"><style>/* IBM Plex fonts (Latin subset) have been downloaded from Google Fonts and modified to add support back in for the `zero` substitution (slashed zeroes) */
15591559
15601560
/* https://fonts.googleapis.com/css2?family=IBM%20Plex%20Serif:ital,wght@0,400;0,700;1,400;1,700&display=swap */
@@ -2980,12 +2980,12 @@
29802980
</ul></div><div id="menu-toggle"><svg xmlns="http://www.w3.org/2000/svg" style="width:100%; height:100%; stroke:currentColor" viewBox="0 0 120 120">
29812981
<title>Menu</title>
29822982
<path stroke-width="10" stroke-linecap="round" d="M30,60 h60 M30,30 m0,5 h60 M30,90 m0,-5 h60"></path>
2983-
</svg></div><div id="menu-spacer" class="menu-spacer"></div><div id="menu"><div id="menu-search"><input type="text" id="menu-search-box" placeholder="Search..."><div id="menu-search-results" class="inactive"></div></div><div id="menu-pins"><div class="menu-pane-header">Pins<button class="unpin-all">clear</button></div><ul id="menu-pins-list"></ul></div><div class="menu-pane-header">Table of Contents</div><div id="menu-toc"><ol class="toc"><li><span class="item-toggle-none"></span><a href="#sec-promise.try" title="Promise.try ( callbackfn )"><span class="secnum">1</span> Promise.try ( <var>callbackfn</var> )</a></li><li><span class="item-toggle-none"></span><a href="#sec-copyright-and-software-license" title="Copyright &amp; Software License"><span class="secnum">A</span> Copyright &amp; Software License</a></li></ol></div></div><div id="spec-container"><h1 class="version">Stage 1 Draft / February 7, 2024</h1><h1 class="title">Promise.try</h1>
2983+
</svg></div><div id="menu-spacer" class="menu-spacer"></div><div id="menu"><div id="menu-search"><input type="text" id="menu-search-box" placeholder="Search..."><div id="menu-search-results" class="inactive"></div></div><div id="menu-pins"><div class="menu-pane-header">Pins<button class="unpin-all">clear</button></div><ul id="menu-pins-list"></ul></div><div class="menu-pane-header">Table of Contents</div><div id="menu-toc"><ol class="toc"><li><span class="item-toggle-none"></span><a href="#sec-promise.try" title="Promise.try ( callbackfn, ...args )"><span class="secnum">1</span> Promise.try ( <var>callbackfn</var>, ...<var>args</var> )</a></li><li><span class="item-toggle-none"></span><a href="#sec-copyright-and-software-license" title="Copyright &amp; Software License"><span class="secnum">A</span> Copyright &amp; Software License</a></li></ol></div></div><div id="spec-container"><h1 class="version">Stage 1 Draft / February 7, 2024</h1><h1 class="title">Promise.try</h1>
29842984
29852985
<emu-clause id="sec-promise.try">
2986-
<h1><span class="secnum">1</span> Promise.try ( <var>callbackfn</var> )</h1>
2986+
<h1><span class="secnum">1</span> Promise.try ( <var>callbackfn</var>, ...<var>args</var> )</h1>
29872987
<p>When the <code>try</code> method is called with argument <var>callbackfn</var>, the following steps are taken:</p>
2988-
<emu-alg><ol><li>Let <var>C</var> be the <emu-val>this</emu-val> value.</li><li>If <var>C</var> <emu-xref href="#sec-object-type"><a href="https://tc39.es/ecma262/#sec-object-type">is not an Object</a></emu-xref>, throw a <emu-val>TypeError</emu-val> exception.</li><li>Let <var>promiseCapability</var> be ?&nbsp;<emu-xref aoid="NewPromiseCapability"><a href="https://tc39.es/ecma262/#sec-newpromisecapability">NewPromiseCapability</a></emu-xref>(<var>C</var>).</li><li>Let <var>status</var> be <emu-xref aoid="Completion"><a href="https://tc39.es/ecma262/#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="Call"><a href="https://tc39.es/ecma262/#sec-call">Call</a></emu-xref>(<var>callbackfn</var>, <emu-val>undefined</emu-val>, « »)).</li><li>If <var>status</var> is an <emu-xref href="#sec-completion-record-specification-type"><a href="https://tc39.es/ecma262/#sec-completion-record-specification-type">abrupt completion</a></emu-xref>, then<ol><li>Perform ?&nbsp;<emu-xref aoid="Call"><a href="https://tc39.es/ecma262/#sec-call">Call</a></emu-xref>(<var>promiseCapability</var>.<var class="field">[[Reject]]</var>, <emu-val>undefined</emu-val>, « <var>status</var>.<var class="field">[[Value]]</var>&nbsp;»).</li></ol></li><li>Else,<ol><li>Perform ?&nbsp;<emu-xref aoid="Call"><a href="https://tc39.es/ecma262/#sec-call">Call</a></emu-xref>(<var>promiseCapability</var>.<var class="field">[[Resolve]]</var>, <emu-val>undefined</emu-val>, « <var>status</var>.<var class="field">[[Value]]</var>&nbsp;»).</li></ol></li><li>Return <var>promiseCapability</var>.<var class="field">[[Promise]]</var>.</li></ol></emu-alg>
2988+
<emu-alg><ol><li>Let <var>C</var> be the <emu-val>this</emu-val> value.</li><li>If <var>C</var> <emu-xref href="#sec-object-type"><a href="https://tc39.es/ecma262/#sec-object-type">is not an Object</a></emu-xref>, throw a <emu-val>TypeError</emu-val> exception.</li><li>Let <var>promiseCapability</var> be ?&nbsp;<emu-xref aoid="NewPromiseCapability"><a href="https://tc39.es/ecma262/#sec-newpromisecapability">NewPromiseCapability</a></emu-xref>(<var>C</var>).</li><li>Let <var>status</var> be <emu-xref aoid="Completion"><a href="https://tc39.es/ecma262/#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="Call"><a href="https://tc39.es/ecma262/#sec-call">Call</a></emu-xref>(<var>callbackfn</var>, <emu-val>undefined</emu-val>, <var>args</var>)).</li><li>If <var>status</var> is an <emu-xref href="#sec-completion-record-specification-type"><a href="https://tc39.es/ecma262/#sec-completion-record-specification-type">abrupt completion</a></emu-xref>, then<ol><li>Perform ?&nbsp;<emu-xref aoid="Call"><a href="https://tc39.es/ecma262/#sec-call">Call</a></emu-xref>(<var>promiseCapability</var>.<var class="field">[[Reject]]</var>, <emu-val>undefined</emu-val>, « <var>status</var>.<var class="field">[[Value]]</var>&nbsp;»).</li></ol></li><li>Else,<ol><li>Perform ?&nbsp;<emu-xref aoid="Call"><a href="https://tc39.es/ecma262/#sec-call">Call</a></emu-xref>(<var>promiseCapability</var>.<var class="field">[[Resolve]]</var>, <emu-val>undefined</emu-val>, « <var>status</var>.<var class="field">[[Value]]</var>&nbsp;»).</li></ol></li><li>Return <var>promiseCapability</var>.<var class="field">[[Promise]]</var>.</li></ol></emu-alg>
29892989
</emu-clause><emu-annex id="sec-copyright-and-software-license">
29902990
<h1><span class="secnum">A</span> Copyright &amp; Software License</h1>
29912991

spec.emu

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ contributors: Jordan Harband
77
</pre>
88

99
<emu-clause id="sec-promise.try">
10-
<h1>Promise.try ( _callbackfn_ )</h1>
10+
<h1>Promise.try ( _callbackfn_, ..._args_ )</h1>
1111
<p>When the `try` method is called with argument _callbackfn_, the following steps are taken:</p>
1212
<emu-alg>
1313
1. Let _C_ be the *this* value.
1414
1. If _C_ is not an Object, throw a *TypeError* exception.
1515
1. Let _promiseCapability_ be ? NewPromiseCapability(_C_).
16-
1. Let _status_ be Completion(Call(_callbackfn_, *undefined*, &laquo; &raquo;)).
16+
1. Let _status_ be Completion(Call(_callbackfn_, *undefined*, _args_)).
1717
1. If _status_ is an abrupt completion, then
1818
1. Perform ? Call(_promiseCapability_.[[Reject]], *undefined*, « _status_.[[Value]] »).
1919
1. Else,

0 commit comments

Comments
 (0)