Re: [whatwg/dom] Add AbortSignal.aborted() static (#960)

@annevk commented on this pull request.

This looks great, thanks for working on this James!

@josepharhar @smaug---- @mfreed7 @rniwa thoughts on adding this? Seems simple enough and there's precedent with promises (`Promise.reject()`). Though maybe that means this should be `AbortSignal.abort()`?

> @@ -1783,12 +1783,16 @@ interface AbortSignal : EventTarget {
   readonly attribute boolean aborted;
 
   attribute EventHandler onabort;
+
+  static AbortSignal aborted();

Slight preference for putting statics at the top. See https://fetch.spec.whatwg.org/#response for instance. I guess this can also have `[NewObject]`.

>  };</pre>
 
 <dl class=domintro>
  <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.
+ <dt><code>AbortSignal . <a method for="AbortSignal">aborted()</a></code>
+ <dd>Returns an {{AbortSignal}} instance whose <a for=AbortSignal>aborted flag</a> is set.

And let's move this to the top too.

> @@ -1864,6 +1868,17 @@ these steps:
   </ol>
 </ol>
 
+<p>The
+<dfn method for=AbortSignal lt="aborted()" id="dom-abortsignal-aborted-static">
+<code>AbortSignal.aborted()</code></dfn> steps are:

This should be:

> The static `aborted()` method steps are:

Also no need for the `id` attribute and I think the `lt` attribute can be dropped as well if you make this change.

(And yes, move to the top.)

-- 
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/960#pullrequestreview-608405570

Received on Wednesday, 10 March 2021 07:45:47 UTC