Code coverage report for src/operator/takeUntil.ts

Statements: 100% (21 / 21)      Branches: 100% (0 / 0)      Functions: 100% (8 / 8)      Lines: 100% (18 / 18)      Ignored: none     

All files » src/operator/ » takeUntil.ts
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37        1 1   1 16     1 16     1 16   1   1   1 16 16 16     1 5     1     1  
import {Operator} from '../Operator';
import {Observable} from '../Observable';
import {Subscriber} from '../Subscriber';
 
import {OuterSubscriber} from '../OuterSubscriber';
import {subscribeToResult} from '../util/subscribeToResult';
 
export function takeUntil<T>(notifier: Observable<any>): Observable<T> {
  return this.lift(new TakeUntilOperator(notifier));
}
 
class TakeUntilOperator<T> implements Operator<T, T> {
  constructor(private notifier: Observable<any>) {
  }
 
  call(subscriber: Subscriber<T>): Subscriber<T> {
    return new TakeUntilSubscriber(subscriber, this.notifier);
  }
}
 
class TakeUntilSubscriber<T, R> extends OuterSubscriber<T, R> {
 
  constructor(destination: Subscriber<any>,
              private notifier: Observable<any>) {
    super(destination);
    this.add(subscribeToResult(this, notifier));
  }
 
  notifyNext(outerValue: T, innerValue: R, outerIndex: number, innerIndex: number): void {
    this.complete();
  }
 
  notifyComplete(): void {
    // noop
  }
}