[6a3a178] | 1 | import { Subscriber } from './Subscriber';
|
---|
| 2 | import { Observable } from './Observable';
|
---|
| 3 | import { subscribeTo } from './util/subscribeTo';
|
---|
| 4 | export class SimpleInnerSubscriber extends Subscriber {
|
---|
| 5 | constructor(parent) {
|
---|
| 6 | super();
|
---|
| 7 | this.parent = parent;
|
---|
| 8 | }
|
---|
| 9 | _next(value) {
|
---|
| 10 | this.parent.notifyNext(value);
|
---|
| 11 | }
|
---|
| 12 | _error(error) {
|
---|
| 13 | this.parent.notifyError(error);
|
---|
| 14 | this.unsubscribe();
|
---|
| 15 | }
|
---|
| 16 | _complete() {
|
---|
| 17 | this.parent.notifyComplete();
|
---|
| 18 | this.unsubscribe();
|
---|
| 19 | }
|
---|
| 20 | }
|
---|
| 21 | export class ComplexInnerSubscriber extends Subscriber {
|
---|
| 22 | constructor(parent, outerValue, outerIndex) {
|
---|
| 23 | super();
|
---|
| 24 | this.parent = parent;
|
---|
| 25 | this.outerValue = outerValue;
|
---|
| 26 | this.outerIndex = outerIndex;
|
---|
| 27 | }
|
---|
| 28 | _next(value) {
|
---|
| 29 | this.parent.notifyNext(this.outerValue, value, this.outerIndex, this);
|
---|
| 30 | }
|
---|
| 31 | _error(error) {
|
---|
| 32 | this.parent.notifyError(error);
|
---|
| 33 | this.unsubscribe();
|
---|
| 34 | }
|
---|
| 35 | _complete() {
|
---|
| 36 | this.parent.notifyComplete(this);
|
---|
| 37 | this.unsubscribe();
|
---|
| 38 | }
|
---|
| 39 | }
|
---|
| 40 | export class SimpleOuterSubscriber extends Subscriber {
|
---|
| 41 | notifyNext(innerValue) {
|
---|
| 42 | this.destination.next(innerValue);
|
---|
| 43 | }
|
---|
| 44 | notifyError(err) {
|
---|
| 45 | this.destination.error(err);
|
---|
| 46 | }
|
---|
| 47 | notifyComplete() {
|
---|
| 48 | this.destination.complete();
|
---|
| 49 | }
|
---|
| 50 | }
|
---|
| 51 | export class ComplexOuterSubscriber extends Subscriber {
|
---|
| 52 | notifyNext(_outerValue, innerValue, _outerIndex, _innerSub) {
|
---|
| 53 | this.destination.next(innerValue);
|
---|
| 54 | }
|
---|
| 55 | notifyError(error) {
|
---|
| 56 | this.destination.error(error);
|
---|
| 57 | }
|
---|
| 58 | notifyComplete(_innerSub) {
|
---|
| 59 | this.destination.complete();
|
---|
| 60 | }
|
---|
| 61 | }
|
---|
| 62 | export function innerSubscribe(result, innerSubscriber) {
|
---|
| 63 | if (innerSubscriber.closed) {
|
---|
| 64 | return undefined;
|
---|
| 65 | }
|
---|
| 66 | if (result instanceof Observable) {
|
---|
| 67 | return result.subscribe(innerSubscriber);
|
---|
| 68 | }
|
---|
| 69 | let subscription;
|
---|
| 70 | try {
|
---|
| 71 | subscription = subscribeTo(result)(innerSubscriber);
|
---|
| 72 | }
|
---|
| 73 | catch (error) {
|
---|
| 74 | innerSubscriber.error(error);
|
---|
| 75 | }
|
---|
| 76 | return subscription;
|
---|
| 77 | }
|
---|
| 78 | //# sourceMappingURL=innerSubscribe.js.map |
---|