DOM: Implement the `flatMap()` Observable operator
This CL implements the `flatMap()` Observable operator. See https://wicg.github.io/observable/#dom-observable-flatmap . To accomplish this, we introduce a class hierarchy that looks like: ``` // The delegate that the Observable returned from flatMap() uses to // create subscriptions. class OperatorFlatMapSubscribeDelegate : Observable::SubscribeDelegate { // One of these is created for each subscription created via the // delegate above. For example: // // const mapped = source.flatMap(...); // const a = mapped.subscribe(...); // const b = mapped.subscribe(...); // // A `SourceInternalObserver` gets created for each of `a` and `b`. class SourceInternalObserver : ObservableInternalObserver { // For each value that the source Observable emits, we derive a new // "inner" Observable from it and subscribe to it for the rest of // its lifetime. This class below is the internal Observer for each // of these. class InnerFlatMapObserver : ObservableInternalObserver { }; }; }; ``` For WPTs: Co-authored-by:<ben@benlesh.com> Bug: 40282760 Change-Id: I281ed693908f4b7c3a6d5f1ce8a70f4c5187018b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5381640 Reviewed-by:
Mason Freed <masonf@chromium.org> Commit-Queue: Dominic Farolino <dom@chromium.org> Cr-Commit-Position: refs/heads/main@{#1279959}
Loading
Please register or sign in to comment