WICG / observable

Observable API proposal
https://wicg.github.io/observable/
Other
543 stars 12 forks source link

Simplify `map()` internal observer #116

Closed domfarolino closed 4 months ago

domfarolino commented 4 months ago

When spec'ing the map() operator, I was originally under the impression that if the Mapper callback threw an error, we would have to signal abort on an AbortController that manipulated the source Observable's subscriber. But upon reading the spec, I realize that simply:

If an exception E was thrown, then run subscriber’s error() method

... is plenty. That's because when we signal error on the "outer" Subscriber, this will abort the AbortSignal associated with that "outer" subscriber's AbortSignal.... and that "outer" AbortSignal is what the source Observable's subscription's signal is derived from.


Preview | Diff