Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add abort reason to AbortSignal #1027

Merged
merged 20 commits into from
Nov 8, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions dom.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1772,7 +1772,7 @@ constructor steps are:
<pre class=idl>
[Exposed=(Window,Worker)]
interface AbortSignal : EventTarget {
[NewObject] static AbortSignal abort();
[NewObject] static AbortSignal abort(optional any reason);

readonly attribute boolean aborted;

Expand All @@ -1782,12 +1782,14 @@ interface AbortSignal : EventTarget {
};</pre>

annevk marked this conversation as resolved.
Show resolved Hide resolved
<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>AbortSignal . <a method for=AbortSignal>abort</a>(reason)</code>
<dd>Returns an {{AbortSignal}} instance whose <a for=AbortSignal>aborted flag</a> is set, and
<a for=AbortSignal>abort reason</a> is set to <var>reason</var> if provided, otherwise to
"{{AbortError!!exception}}" {{DOMException}}.
nidhijaju marked this conversation as resolved.
Show resolved Hide resolved

<dt><code><var>signal</var> . <a attribute for=AbortSignal>reason</a></code>
<dd>Returns the <a for=AbortSignal>abort reason</a> for an {{AbortSignal}} if it has been
nidhijaju marked this conversation as resolved.
Show resolved Hide resolved
set; otherwise returns an "{{AbortError!!exception}}" {{DOMException}}.
set; by default this will be an "{{AbortError!!exception}}" {{DOMException}}.

<dt><code><var>signal</var> . <a attribute for=AbortSignal>aborted</a></code>
<dd>Returns true if this {{AbortSignal}}'s {{AbortController}} has signaled to abort; otherwise
Expand Down Expand Up @@ -1823,13 +1825,18 @@ 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:
<p>The static <dfn method for=AbortSignal><code>abort(reason)</code></dfn> method steps are:
nidhijaju marked this conversation as resolved.
Show resolved Hide resolved

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

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

<li><p>If <var>reason</var> is undefined or not given, then let <var>reason</var> be a new
annevk marked this conversation as resolved.
Show resolved Hide resolved
"{{AbortError!!exception}}" {{DOMException}}.

<li><p>Set <var>signal</var>'s [=AbortSignal/abort reason=] to <var>reason</var>.

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

Expand Down