innerSubscribe.js
1.91 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import { Subscriber } from './Subscriber';
import { Observable } from './Observable';
import { subscribeTo } from './util/subscribeTo';
export class SimpleInnerSubscriber extends Subscriber {
constructor(parent) {
super();
this.parent = parent;
}
_next(value) {
this.parent.notifyNext(value);
}
_error(error) {
this.parent.notifyError(error);
this.unsubscribe();
}
_complete() {
this.parent.notifyComplete();
this.unsubscribe();
}
}
export class ComplexInnerSubscriber extends Subscriber {
constructor(parent, outerValue, outerIndex) {
super();
this.parent = parent;
this.outerValue = outerValue;
this.outerIndex = outerIndex;
}
_next(value) {
this.parent.notifyNext(this.outerValue, value, this.outerIndex, this);
}
_error(error) {
this.parent.notifyError(error);
this.unsubscribe();
}
_complete() {
this.parent.notifyComplete(this);
this.unsubscribe();
}
}
export class SimpleOuterSubscriber extends Subscriber {
notifyNext(innerValue) {
this.destination.next(innerValue);
}
notifyError(err) {
this.destination.error(err);
}
notifyComplete() {
this.destination.complete();
}
}
export class ComplexOuterSubscriber extends Subscriber {
notifyNext(_outerValue, innerValue, _outerIndex, _innerSub) {
this.destination.next(innerValue);
}
notifyError(error) {
this.destination.error(error);
}
notifyComplete(_innerSub) {
this.destination.complete();
}
}
export function innerSubscribe(result, innerSubscriber) {
if (innerSubscriber.closed) {
return undefined;
}
if (result instanceof Observable) {
return result.subscribe(innerSubscriber);
}
return subscribeTo(result)(innerSubscriber);
}
//# sourceMappingURL=innerSubscribe.js.map