Skip to content

Commit

Permalink
[spec] add note about receiver convention
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Feb 8, 2024
1 parent e804662 commit fdb9bd2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2980,12 +2980,15 @@
</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">
<title>Menu</title>
<path stroke-width="10" stroke-linecap="round" d="M30,60 h60 M30,30 m0,5 h60 M30,90 m0,-5 h60"></path>
</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>
</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 8, 2024</h1><h1 class="title">Promise.try</h1>
<emu-clause id="sec-promise.try">
<h1><span class="secnum">1</span> Promise.try ( <var>callbackfn</var> )</h1>
<p>When the <code>try</code> method is called with argument <var>callbackfn</var>, the following steps are taken:</p>
<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>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>This function expects its <emu-val>this</emu-val> value to be a <emu-xref href="#constructor"><a href="https://tc39.es/ecma262/#constructor">constructor</a></emu-xref> function that supports the parameter conventions of the Promise <emu-xref href="#constructor"><a href="https://tc39.es/ecma262/#constructor">constructor</a></emu-xref>.</p>
</div></emu-note>
</emu-clause><emu-annex id="sec-copyright-and-software-license">
<h1><span class="secnum">A</span> Copyright &amp; Software License</h1>
Expand Down
3 changes: 3 additions & 0 deletions spec.emu
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,7 @@ contributors: Jordan Harband
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>

0 comments on commit fdb9bd2

Please sign in to comment.