1 | "use strict";
|
---|
2 | var __extends = (this && this.__extends) || (function () {
|
---|
3 | var extendStatics = function (d, b) {
|
---|
4 | extendStatics = Object.setPrototypeOf ||
|
---|
5 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
---|
6 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
---|
7 | return extendStatics(d, b);
|
---|
8 | }
|
---|
9 | return function (d, b) {
|
---|
10 | extendStatics(d, b);
|
---|
11 | function __() { this.constructor = d; }
|
---|
12 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
---|
13 | };
|
---|
14 | })();
|
---|
15 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
16 | var Subscriber_1 = require("./Subscriber");
|
---|
17 | var Observable_1 = require("./Observable");
|
---|
18 | var subscribeTo_1 = require("./util/subscribeTo");
|
---|
19 | var SimpleInnerSubscriber = (function (_super) {
|
---|
20 | __extends(SimpleInnerSubscriber, _super);
|
---|
21 | function SimpleInnerSubscriber(parent) {
|
---|
22 | var _this = _super.call(this) || this;
|
---|
23 | _this.parent = parent;
|
---|
24 | return _this;
|
---|
25 | }
|
---|
26 | SimpleInnerSubscriber.prototype._next = function (value) {
|
---|
27 | this.parent.notifyNext(value);
|
---|
28 | };
|
---|
29 | SimpleInnerSubscriber.prototype._error = function (error) {
|
---|
30 | this.parent.notifyError(error);
|
---|
31 | this.unsubscribe();
|
---|
32 | };
|
---|
33 | SimpleInnerSubscriber.prototype._complete = function () {
|
---|
34 | this.parent.notifyComplete();
|
---|
35 | this.unsubscribe();
|
---|
36 | };
|
---|
37 | return SimpleInnerSubscriber;
|
---|
38 | }(Subscriber_1.Subscriber));
|
---|
39 | exports.SimpleInnerSubscriber = SimpleInnerSubscriber;
|
---|
40 | var ComplexInnerSubscriber = (function (_super) {
|
---|
41 | __extends(ComplexInnerSubscriber, _super);
|
---|
42 | function ComplexInnerSubscriber(parent, outerValue, outerIndex) {
|
---|
43 | var _this = _super.call(this) || this;
|
---|
44 | _this.parent = parent;
|
---|
45 | _this.outerValue = outerValue;
|
---|
46 | _this.outerIndex = outerIndex;
|
---|
47 | return _this;
|
---|
48 | }
|
---|
49 | ComplexInnerSubscriber.prototype._next = function (value) {
|
---|
50 | this.parent.notifyNext(this.outerValue, value, this.outerIndex, this);
|
---|
51 | };
|
---|
52 | ComplexInnerSubscriber.prototype._error = function (error) {
|
---|
53 | this.parent.notifyError(error);
|
---|
54 | this.unsubscribe();
|
---|
55 | };
|
---|
56 | ComplexInnerSubscriber.prototype._complete = function () {
|
---|
57 | this.parent.notifyComplete(this);
|
---|
58 | this.unsubscribe();
|
---|
59 | };
|
---|
60 | return ComplexInnerSubscriber;
|
---|
61 | }(Subscriber_1.Subscriber));
|
---|
62 | exports.ComplexInnerSubscriber = ComplexInnerSubscriber;
|
---|
63 | var SimpleOuterSubscriber = (function (_super) {
|
---|
64 | __extends(SimpleOuterSubscriber, _super);
|
---|
65 | function SimpleOuterSubscriber() {
|
---|
66 | return _super !== null && _super.apply(this, arguments) || this;
|
---|
67 | }
|
---|
68 | SimpleOuterSubscriber.prototype.notifyNext = function (innerValue) {
|
---|
69 | this.destination.next(innerValue);
|
---|
70 | };
|
---|
71 | SimpleOuterSubscriber.prototype.notifyError = function (err) {
|
---|
72 | this.destination.error(err);
|
---|
73 | };
|
---|
74 | SimpleOuterSubscriber.prototype.notifyComplete = function () {
|
---|
75 | this.destination.complete();
|
---|
76 | };
|
---|
77 | return SimpleOuterSubscriber;
|
---|
78 | }(Subscriber_1.Subscriber));
|
---|
79 | exports.SimpleOuterSubscriber = SimpleOuterSubscriber;
|
---|
80 | var ComplexOuterSubscriber = (function (_super) {
|
---|
81 | __extends(ComplexOuterSubscriber, _super);
|
---|
82 | function ComplexOuterSubscriber() {
|
---|
83 | return _super !== null && _super.apply(this, arguments) || this;
|
---|
84 | }
|
---|
85 | ComplexOuterSubscriber.prototype.notifyNext = function (_outerValue, innerValue, _outerIndex, _innerSub) {
|
---|
86 | this.destination.next(innerValue);
|
---|
87 | };
|
---|
88 | ComplexOuterSubscriber.prototype.notifyError = function (error) {
|
---|
89 | this.destination.error(error);
|
---|
90 | };
|
---|
91 | ComplexOuterSubscriber.prototype.notifyComplete = function (_innerSub) {
|
---|
92 | this.destination.complete();
|
---|
93 | };
|
---|
94 | return ComplexOuterSubscriber;
|
---|
95 | }(Subscriber_1.Subscriber));
|
---|
96 | exports.ComplexOuterSubscriber = ComplexOuterSubscriber;
|
---|
97 | function innerSubscribe(result, innerSubscriber) {
|
---|
98 | if (innerSubscriber.closed) {
|
---|
99 | return undefined;
|
---|
100 | }
|
---|
101 | if (result instanceof Observable_1.Observable) {
|
---|
102 | return result.subscribe(innerSubscriber);
|
---|
103 | }
|
---|
104 | var subscription;
|
---|
105 | try {
|
---|
106 | subscription = subscribeTo_1.subscribeTo(result)(innerSubscriber);
|
---|
107 | }
|
---|
108 | catch (error) {
|
---|
109 | innerSubscriber.error(error);
|
---|
110 | }
|
---|
111 | return subscription;
|
---|
112 | }
|
---|
113 | exports.innerSubscribe = innerSubscribe;
|
---|
114 | //# sourceMappingURL=innerSubscribe.js.map |
---|