AbortSignal.any() #166
Labels
from: Google
Proposed, edited, or co-edited by Google.
position: support
topic: dom
Spec relates to DOM (Document Object Model)
topic: javascript
Spec relates to the JavaScript programming language
topic: performance
venue: none / personal repository
The venue for discussion is a GitHub repository not affiliated with a standards body.
venue: WHATWG DOM Workstream
Milestone
WebKittens
@annevk
Title of the spec
AbortSignal.any()
URL to the spec
whatwg/dom#1152
URL to the spec's repository
https://github.com/whatwg/dom
Issue Tracker URL
https://github.com/shaseley/abort-signal-any/issues
Explainer URL
https://github.com/shaseley/abort-signal-any
TAG Design Review URL
w3ctag/design-reviews#737
Mozilla standards-positions issue URL
mozilla/standards-positions#774
WebKit Bugzilla URL
No response
Radar URL
No response
Description
AbortSignal.any(signals)
returns an AbortSignal that is aborted when any of the source signals are aborted. Developers can use this to combine independent abort sources, e.g. timeouts specified withAbortSignal.timeout()
and signals associated with user input, and pass them to async APIs likefetch()
.Memory management: composite signals (those returned by this API) must be kept alive while they can be aborted (by one of the sources) and have registered 'abort' event listeners or pending abort algorithms (see GC note in the spec PR). Implementing this API in userland has proved difficult to do without leaks, e.g. because of lack of knowledge about pending abort algorithms, but can be done by the browser where we have more visibility.
To implement the memory management in Chromium, we needed to clean up handling of pending abort algorithms, specifically making sure they get removed when they can no longer have an effect (e.g. when all related
fetch
state has been GCed). See also this issue.The text was updated successfully, but these errors were encountered: