Contact [email protected]

Explainerhttps://github.com/WICG/observable

SpecificationNone

Summary

Observables are a popular reactive-programming paradigm to handle an
asynchronous stream of push-based events. They can be thought of as
Promises but for multiple events, and aim to do what Promises did for
callbacks/nesting. That is, they allow ergonomic event handling by
providing an "Observable" object that represents the asynchronous flow of
events. You can "subscribe" to receive events as they come in, but more
importantly, this object exposes a series of operators & combinators that
let you to declaratively describe the flow of transformations through which
events go. This is in contrast with the imperative version, which often
requires complicated nesting with things like `addEventListener()`. For
more on this, see the examples in the explainer. The big selling point for
native Observables is their integration with EventTarget — its proposed
`on()` method that returns an Observable which is a "better"
`addEventListener()`. See https://github.com/WICG/observable and
https://twitter.com/domfarolino/status/1684921351004430336. See the
in-progress implementation design doc:
https://docs.google.com/document/d/1NEobxgiQO-fTSocxJBqcOOOVZRmXcTFg9Iqrhebb7bg/edit


Blink componentBlink>DOM
<https://bugs.chromium.org/p/chromium/issues/list?q=component:Blink%3EDOM>

Motivation

Promises gave web developers a synchronously-available handle representing
a single value that will be available asynchronously later. This lets
developers write linear, declarative-style flows that outline how an
asynchronous value will eventually be handled, avoiding "callback" hell.
The web does not have a good analogous primitive for an async *stream of
multiple* events, and Observables finally brings this primitive to the web.
They let you declaratively establish a pipeline of composable operators
through which an asynchronous stream of events will flow. See the explainer
and its examples for more.


Initial public proposalhttps://github.com/whatwg/dom/issues/544 and
https://github.com/WICG/observable

TAG reviewhttps://github.com/w3ctag/design-reviews/issues/902

TAG review statusPending

Risks


Interoperability and Compatibility

Our addition of a native EventTarget#on() method *might* collide with
method names used by other libraries in the wild. However at the moment
we're not sure this would collide with any EventTarget monkey-patching
libraries, or even how serious this overall collision might be. See
https://github.com/WICG/observable/issues/39.


*Gecko*: No signal

*WebKit*: No signal

*Web developers*: Strongly positive (
https://twitter.com/domfarolino/status/1684921351004430336) Also see
https://foolip.github.io/spec-reactions/ and the developer interest in the
original WHATWG DOM issue.

*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?

None


Debuggability

The developer experience of Observables might benefit from
Observable-specific DevTools tracking of events and streams (see
https://github.com/WICG/observable/issues/55). It is possible that the
existing DevTools work that assists asynchronous task tracking and
callstack tagging may be sufficient though. At the moment, however, our
effort is focused on the platform implementation of Observables.


Is this feature fully tested by web-platform-tests
<https://chromium.googlesource.com/chromium/src/+/main/docs/testing/web_platform_tests.md>
?No

Flag name on chrome://flagsNone

Finch feature nameNone

Non-finch justificationNone

Requires code in //chrome?False

Tracking bughttps://bugs.chromium.org/p/chromium/issues/detail?id=1485981

Estimated milestones

No milestones specified


Link to entry on the Chrome Platform Status
https://chromestatus.com/feature/5154593776599040

This intent message was generated by Chrome Platform Status
<https://chromestatus.com/>.

-- 
You received this message because you are subscribed to the Google Groups 
"blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAP-uykBH1%3DUoLN6%3DBRSEZE%2B1iUq6UdcTpo3qtTQ5T%3DSRxwnu5Q%40mail.gmail.com.

Reply via email to