source: trip-planner-front/node_modules/rxjs/_esm2015/internal/innerSubscribe.js@ 6c1585f

Last change on this file since 6c1585f was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.0 KB
Line 
1import { Subscriber } from './Subscriber';
2import { Observable } from './Observable';
3import { subscribeTo } from './util/subscribeTo';
4export 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}
21export 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}
40export 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}
51export 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}
62export 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
Note: See TracBrowser for help on using the repository browser.