InnerSubscriber.ts 742 B

1234567891011121314151617181920212223242526272829
  1. import { Subscriber } from './Subscriber';
  2. import { OuterSubscriber } from './OuterSubscriber';
  3. /**
  4. * We need this JSDoc comment for affecting ESDoc.
  5. * @ignore
  6. * @extends {Ignored}
  7. */
  8. export class InnerSubscriber<T, R> extends Subscriber<R> {
  9. private index: number = 0;
  10. constructor(private parent: OuterSubscriber<T, R>, private outerValue: T, private outerIndex: number) {
  11. super();
  12. }
  13. protected _next(value: R): void {
  14. this.parent.notifyNext(this.outerValue, value, this.outerIndex, this.index++, this);
  15. }
  16. protected _error(error: any): void {
  17. this.parent.notifyError(error, this);
  18. this.unsubscribe();
  19. }
  20. protected _complete(): void {
  21. this.parent.notifyComplete(this);
  22. this.unsubscribe();
  23. }
  24. }