Code coverage report for src/operator/finally.ts

Statements: 100% (17 / 17)      Branches: 100% (0 / 0)      Functions: 100% (6 / 6)      Lines: 100% (14 / 14)      Ignored: none     

All files » src/operator/ » finally.ts
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23  1 1   1 3     1 3     1 3   1   1 1 3 3   1
import {Operator} from '../Operator';
import {Subscriber} from '../Subscriber';
import {Subscription} from '../Subscription';
 
export function _finally<T>(finallySelector: () => void) {
  return this.lift(new FinallyOperator(finallySelector));
}
 
class FinallyOperator<T, R> implements Operator<T, R> {
  constructor(private finallySelector: () => void) {
  }
 
  call(subscriber: Subscriber<T>): Subscriber<T> {
    return new FinallySubscriber(subscriber, this.finallySelector);
  }
}
 
class FinallySubscriber<T> extends Subscriber<T> {
  constructor(destination: Subscriber<T>, finallySelector: () => void) {
    super(destination);
    this.add(new Subscription(finallySelector));
  }
}