Skip to content

Commit 3acd735

Browse files
committed
Add abortSignal.addAbortCallback
1 parent 918ebc0 commit 3acd735

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

dom.bs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1926,6 +1926,7 @@ interface AbortSignal : EventTarget {
19261926
readonly attribute boolean aborted;
19271927
readonly attribute any reason;
19281928
undefined throwIfAborted();
1929+
undefined addAbortCallback(VoidFunction callback);
19291930

19301931
attribute EventHandler onabort;
19311932
};</pre>
@@ -2037,6 +2038,26 @@ is [=AbortSignal/aborted=]; otherwise false.
20372038
<p>The <dfn method for=AbortSignal>throwIfAborted()</dfn> method steps are to throw <a>this</a>'s
20382039
<a for=AbortSignal>abort reason</a>, if <a>this</a> is [=AbortSignal/aborted=].
20392040

2041+
<div algorithm>
2042+
<p>The <dfn method for=AbortSignal><code>addAbortCallback(<var>callback</var>)</code></dfn> method steps are:
2043+
2044+
<ol>
2045+
<li><p>If <a>this</a> is [=AbortSignal/aborted=], then:
2046+
<ol>
2047+
<li><p><a spec=webidl>invoke</a> <var>callback</var> with « », and "<code>report</code>".
2048+
2049+
<li><p>Return.
2050+
</ol>
2051+
2052+
2053+
<li>
2054+
<p>[=AbortSignal/Add|Add the following abort steps=] to [=this=]:</p>
2055+
<ol>
2056+
<li><p><a spec=webidl>invoke</a> <var>callback</var> with « », and "<code>report</code>".
2057+
</ol>
2058+
</ol>
2059+
</div>
2060+
20402061
<div class=example id=example-throwifaborted>
20412062
<p>This method is primarily useful for when functions accepting {{AbortSignal}}s want to throw (or
20422063
return a rejected promise) at specific checkpoints, instead of passing along the {{AbortSignal}}

0 commit comments

Comments
 (0)