SHARE
TWEET

flatMap Help

a guest Aug 24th, 2017 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.      flatMap<Output>(streamCreator: (_: T) => Observable<Output>): Observable<Output> {
  2.          // Observer that will be common to all.
  3.          const observer0 = {
  4.              next: undefined;
  5.              complete: undefined;
  6.          }
  7.  
  8.          // This will be the Observable that will be returned.
  9.          const mainObservable = new Observable(observer1 => {
  10.              // Making it so that it calls next an complete on our "this" chain of Observables.
  11.              observer0.next = n => observer1.next(n);
  12.              observer0.complete = () => observer1.complete();
  13.  
  14.              this.subscribe(observer0.next, observer0.complete);
  15.          });
  16.  
  17.          // TODO: This is what I need to do to finish this function.
  18.          // Make Observable with streamCreator.
  19.          // Subscribe it to observer0.
  20.      }
RAW Paste Data
Top