Re: [whatwg/dom] Add AbortSignal.any() (PR #1152)

@shaseley commented on this pull request.

Thanks for reviewing!

> @@ -1802,6 +1806,11 @@ interface AbortSignal : EventTarget {
  <dd>Returns an {{AbortSignal}} instance whose <a for=AbortSignal>abort reason</a> is set to
  <var>reason</var> if not undefined; otherwise to an "{{AbortError!!exception}}" {{DOMException}}.
 
+ <dt><code>AbortSignal . <a method for=AbortSignal lt=any(signals)>any</a>(<var>signals</var>)</code>
+ <dd>Returns an {{AbortSignal}} instance which will be aborted once any of <var>signals</var> is
+ aborted. Its <a for=AbortSignal>abort reason</a> will be set to whichever one of <var>signals</var>
+ cause it to be aborted.

Arg, thanks. I think causes or caused both work (using caused).

> @@ -1828,6 +1837,17 @@ JavaScript value. It is undefined unless specified otherwise.
 <a for=/>set</a> of algorithms which are to be executed when it is [=AbortSignal/aborted=]. Unless
 specified otherwise, its value is the empty set.
 
+<p>An {{AbortSignal}} object has a <dfn for="AbortSignal">composite</dfn> (a boolean), which is
+initially false.
+
+<p>An {{AbortSignal}} object has associated <dfn for=AbortSignal>source signals</dfn>, which is a
+<a for=/>set</a> of weak references to {{AbortSignal}}s that the object is dependent on for its

Sounds good; done.

> + <li><p><a for=set>Empty</a> <var>signal</var>'s <a for=AbortSignal>dependent signals</a>.
+
+ <li><p><a for=set>Empty</a> <var>signal</var>'s <a for=AbortSignal>source signals</a>.

Ah yes, technically these can be removed, and consistency sgtm. But the GC section should probably be updated to reflect that we need only consider non-aborted signals (this was previously implied by source signals being empty for aborted signals).

I've removed clearing the sets and tweaked the GC section to say "A non-aborted composite signal..."

>    </ol>
+ <li>Return <var>resultSignal</var>.

Done.

>  </ol>
 
 
+<h4 id=abort-signal-garbage-collection>Garbage collection</h4>
+
+<p>A [=AbortSignal/composite=] {{AbortSignal}} object must not be garbage collected while its
+[=AbortSignal/source signals=] is non-empty unless it has no registered event listeners for its

Yeah that's probably better. I think "unless ..." was me trying to make the "and ... or" unambiguous, but it's a bit awkward.

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

Message ID: <whatwg/dom/pull/1152/review/1327274774@github.com>

Received on Monday, 6 March 2023 22:48:09 UTC