[6a3a178] | 1 | /** PURE_IMPORTS_START tslib,_observable_from,_util_isArray,_innerSubscribe PURE_IMPORTS_END */
|
---|
| 2 | import * as tslib_1 from "tslib";
|
---|
| 3 | import { from } from '../observable/from';
|
---|
| 4 | import { isArray } from '../util/isArray';
|
---|
| 5 | import { SimpleOuterSubscriber, SimpleInnerSubscriber, innerSubscribe } from '../innerSubscribe';
|
---|
| 6 | export function onErrorResumeNext() {
|
---|
| 7 | var nextSources = [];
|
---|
| 8 | for (var _i = 0; _i < arguments.length; _i++) {
|
---|
| 9 | nextSources[_i] = arguments[_i];
|
---|
| 10 | }
|
---|
| 11 | if (nextSources.length === 1 && isArray(nextSources[0])) {
|
---|
| 12 | nextSources = nextSources[0];
|
---|
| 13 | }
|
---|
| 14 | return function (source) { return source.lift(new OnErrorResumeNextOperator(nextSources)); };
|
---|
| 15 | }
|
---|
| 16 | export function onErrorResumeNextStatic() {
|
---|
| 17 | var nextSources = [];
|
---|
| 18 | for (var _i = 0; _i < arguments.length; _i++) {
|
---|
| 19 | nextSources[_i] = arguments[_i];
|
---|
| 20 | }
|
---|
| 21 | var source = undefined;
|
---|
| 22 | if (nextSources.length === 1 && isArray(nextSources[0])) {
|
---|
| 23 | nextSources = nextSources[0];
|
---|
| 24 | }
|
---|
| 25 | source = nextSources.shift();
|
---|
| 26 | return from(source).lift(new OnErrorResumeNextOperator(nextSources));
|
---|
| 27 | }
|
---|
| 28 | var OnErrorResumeNextOperator = /*@__PURE__*/ (function () {
|
---|
| 29 | function OnErrorResumeNextOperator(nextSources) {
|
---|
| 30 | this.nextSources = nextSources;
|
---|
| 31 | }
|
---|
| 32 | OnErrorResumeNextOperator.prototype.call = function (subscriber, source) {
|
---|
| 33 | return source.subscribe(new OnErrorResumeNextSubscriber(subscriber, this.nextSources));
|
---|
| 34 | };
|
---|
| 35 | return OnErrorResumeNextOperator;
|
---|
| 36 | }());
|
---|
| 37 | var OnErrorResumeNextSubscriber = /*@__PURE__*/ (function (_super) {
|
---|
| 38 | tslib_1.__extends(OnErrorResumeNextSubscriber, _super);
|
---|
| 39 | function OnErrorResumeNextSubscriber(destination, nextSources) {
|
---|
| 40 | var _this = _super.call(this, destination) || this;
|
---|
| 41 | _this.destination = destination;
|
---|
| 42 | _this.nextSources = nextSources;
|
---|
| 43 | return _this;
|
---|
| 44 | }
|
---|
| 45 | OnErrorResumeNextSubscriber.prototype.notifyError = function () {
|
---|
| 46 | this.subscribeToNextSource();
|
---|
| 47 | };
|
---|
| 48 | OnErrorResumeNextSubscriber.prototype.notifyComplete = function () {
|
---|
| 49 | this.subscribeToNextSource();
|
---|
| 50 | };
|
---|
| 51 | OnErrorResumeNextSubscriber.prototype._error = function (err) {
|
---|
| 52 | this.subscribeToNextSource();
|
---|
| 53 | this.unsubscribe();
|
---|
| 54 | };
|
---|
| 55 | OnErrorResumeNextSubscriber.prototype._complete = function () {
|
---|
| 56 | this.subscribeToNextSource();
|
---|
| 57 | this.unsubscribe();
|
---|
| 58 | };
|
---|
| 59 | OnErrorResumeNextSubscriber.prototype.subscribeToNextSource = function () {
|
---|
| 60 | var next = this.nextSources.shift();
|
---|
| 61 | if (!!next) {
|
---|
| 62 | var innerSubscriber = new SimpleInnerSubscriber(this);
|
---|
| 63 | var destination = this.destination;
|
---|
| 64 | destination.add(innerSubscriber);
|
---|
| 65 | var innerSubscription = innerSubscribe(next, innerSubscriber);
|
---|
| 66 | if (innerSubscription !== innerSubscriber) {
|
---|
| 67 | destination.add(innerSubscription);
|
---|
| 68 | }
|
---|
| 69 | }
|
---|
| 70 | else {
|
---|
| 71 | this.destination.complete();
|
---|
| 72 | }
|
---|
| 73 | };
|
---|
| 74 | return OnErrorResumeNextSubscriber;
|
---|
| 75 | }(SimpleOuterSubscriber));
|
---|
| 76 | //# sourceMappingURL=onErrorResumeNext.js.map
|
---|