Intent to Prototype: AbortSignal.any()

115 kali dilihat
Langsung ke pesan pertama yang belum dibaca

Scott Haseley

belum dibaca,
27 Mei 2022, 19.40.4527/05/22
kepadablink-dev

Contact emails

shas...@chromium.org

Explainer

https://github.com/shaseley/abort-signal-any/blob/main/README.md

Specification

The spec work is in progress; I'll send out PRs when I make progress on implementation and tests. Rough drafts:

Design docs

https://docs.google.com/document/d/1LvmsBLV85p-PhSGvTH-YwgD6onuhh1VXLg8jPlH32H4/edit#heading=h.xp6e50wyimb4

Summary

AbortSignal.any(signals) returns a signal that is aborted when any of the source signals are aborted. Developers can use this to combine independent abort sources, e.g. timeouts specified with AbortSignal.timeout() and signals associated with user input, and pass them to async APIs like fetch().



Blink component

Blink>DOM

Motivation

Some async operations may be aborted due to a variety of reasons, e.g. due to timeout or user cancellation. And while nothing prevents an AbortController's abort method from being invoked for multiple reasons, combining signals enables separate layers of control, where the scope of cancellation may vary. Since AbortSignal-accepting APIs only accept a single signal, combining signals currently needs to be done in userland using event listeners, but this is complicated by challenges around memory leaks. AbortSignal.any() makes it easy to combine signals, and by allowing the UA to maintain these relationships, the UA can free related resources when safe to do so.



Initial public proposal

https://github.com/whatwg/dom/issues/920

TAG review

https://github.com/w3ctag/design-reviews/issues/737

TAG review status

Pending

Risks



Interoperability and Compatibility



Gecko: No signal

WebKit: No signal

Web developers: No signals

Other signals:

WebView application risks

Does this intent deprecate or change behavior of existing APIs, such that it has potentially high risk for Android WebView-based applications?



Debuggability

Basic support only.



Is this feature fully tested by web-platform-tests?

No

Flag name



Requires code in //chrome?

False

Tracking bug

https://bugs.chromium.org/p/chromium/issues/detail?id=1323391

Estimated milestones

No milestones specified



Link to entry on the Chrome Platform Status

https://chromestatus.com/feature/5202879349522432

This intent message was generated by Chrome Platform Status.
Balas ke semua
Balas ke penulis
Teruskan
0 pesan baru