Skip to content

Commit

Permalink
Add AbortSignal.abort() static method
Browse files Browse the repository at this point in the history
Returns an aborted AbortSignal.

Tests: web-platform-tests/wpt#28003.

Fixes #959.
  • Loading branch information
jasnell authored Mar 12, 2021
1 parent 9979022 commit aa384af
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions dom.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1780,12 +1780,17 @@ constructor steps are:
<pre class="idl">
[Exposed=(Window,Worker)]
interface AbortSignal : EventTarget {
[NewObject] static AbortSignal abort();

readonly attribute boolean aborted;

attribute EventHandler onabort;
};</pre>

<dl class=domintro>
<dt><code>AbortSignal . <a method for="AbortSignal">abort()</a></code>
<dd>Returns an {{AbortSignal}} instance whose <a for=AbortSignal>aborted flag</a> is set.

<dt><code><var>signal</var> . <a attribute for=AbortSignal>aborted</a></code>
<dd>Returns true if this {{AbortSignal}}'s {{AbortController}} has signaled to abort, and false
otherwise.
Expand Down Expand Up @@ -1817,6 +1822,16 @@ requirements to react in a reasonable way to {{AbortController/abort()}}. For ex
[=AbortSignal/aborted flag=] might need to be propagated to a cross-thread environment, such as a
service worker.

<p>The static <dfn method for=AbortSignal><code>abort()</code></dfn> method steps are:

<ol>
<li><p>Let <var>signal</var> be a new {{AbortSignal}} object.

<li><p>Set <var>signal</var>'s [=AbortSignal/aborted flag=].

<li>Return <var>signal</var>.
</ol>

<p>The <dfn attribute for=AbortSignal>aborted</dfn> getter steps are to return true if <a>this</a>'s
[=AbortSignal/aborted flag=] is set; otherwise false.

Expand Down Expand Up @@ -10036,6 +10051,7 @@ Jake Archibald<!-- technically B.J. Archibald -->,
Jake Verbaten,
James Graham,
James Greene,
James M Snell,
James Robinson,
Jeffrey Yasskin,
Jens Lindström,
Expand Down

0 comments on commit aa384af

Please sign in to comment.