Re: [whatwg/dom] Add abort reason to AbortSignal (PR #1027)

@domenic commented on this pull request.

The main logic looks great now.

I'm still interested to gather more opinions on `reason` vs. `abortReason`... maybe @jasnell can help represent other-ecosystems perspectives.

>    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>reason</a></code>
+ <dd>Returns the <a for=AbortSignal>abort reason</a> for an {{AbortSignal}} if it has been
+ set; otherwise returns an "{{AbortError!!exception}}" {{DOMException}}.

Maybe `by default this will be an "AbortError" DOMException`?

> @@ -1775,13 +1776,19 @@ interface AbortSignal : EventTarget {
 
   readonly attribute boolean aborted;
 
+  readonly attribute any reason;
+
   attribute EventHandler onabort;
 };</pre>
 

We should probably update the static `abort()` method to also accept a reason.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/pull/1027#pullrequestreview-784922196

Received on Wednesday, 20 October 2021 19:43:50 UTC