summaryrefslogtreecommitdiff
path: root/tools/node_modules/eslint/node_modules/rxjs/bundles/rxjs.umd.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/node_modules/eslint/node_modules/rxjs/bundles/rxjs.umd.js')
-rw-r--r--tools/node_modules/eslint/node_modules/rxjs/bundles/rxjs.umd.js147
1 files changed, 100 insertions, 47 deletions
diff --git a/tools/node_modules/eslint/node_modules/rxjs/bundles/rxjs.umd.js b/tools/node_modules/eslint/node_modules/rxjs/bundles/rxjs.umd.js
index ec56138e41..31262c4121 100644
--- a/tools/node_modules/eslint/node_modules/rxjs/bundles/rxjs.umd.js
+++ b/tools/node_modules/eslint/node_modules/rxjs/bundles/rxjs.umd.js
@@ -696,9 +696,9 @@ function flattenUnsubscriptionErrors(errors) {
return errors.reduce(function (errs, err) { return errs.concat((err instanceof UnsubscriptionError) ? err.errors : err); }, []);
}
-var rxSubscriber = (typeof Symbol === 'function' && typeof Symbol.for === 'function')
- ? Symbol.for('rxSubscriber')
- : '@@rxSubscriber';
+var rxSubscriber = typeof Symbol === 'function'
+ ? Symbol('rxSubscriber')
+ : '@@rxSubscriber_' + Math.random();
var Subscriber = (function (_super) {
__extends(Subscriber, _super);
@@ -719,11 +719,10 @@ var Subscriber = (function (_super) {
break;
}
if (typeof destinationOrNext === 'object') {
- if (isTrustedSubscriber(destinationOrNext)) {
- var trustedSubscriber = destinationOrNext[rxSubscriber]();
- _this.syncErrorThrowable = trustedSubscriber.syncErrorThrowable;
- _this.destination = trustedSubscriber;
- trustedSubscriber._addParentTeardownLogic(_this);
+ if (destinationOrNext instanceof Subscriber) {
+ _this.syncErrorThrowable = destinationOrNext.syncErrorThrowable;
+ _this.destination = destinationOrNext;
+ destinationOrNext.add(_this);
}
else {
_this.syncErrorThrowable = true;
@@ -753,14 +752,12 @@ var Subscriber = (function (_super) {
if (!this.isStopped) {
this.isStopped = true;
this._error(err);
- this._unsubscribeParentSubscription();
}
};
Subscriber.prototype.complete = function () {
if (!this.isStopped) {
this.isStopped = true;
this._complete();
- this._unsubscribeParentSubscription();
}
};
Subscriber.prototype.unsubscribe = function () {
@@ -781,16 +778,6 @@ var Subscriber = (function (_super) {
this.destination.complete();
this.unsubscribe();
};
- Subscriber.prototype._addParentTeardownLogic = function (parentTeardownLogic) {
- if (parentTeardownLogic !== this) {
- this._parentSubscription = this.add(parentTeardownLogic);
- }
- };
- Subscriber.prototype._unsubscribeParentSubscription = function () {
- if (this._parentSubscription !== null) {
- this._parentSubscription.unsubscribe();
- }
- };
Subscriber.prototype._unsubscribeAndRecycle = function () {
var _a = this, _parent = _a._parent, _parents = _a._parents;
this._parent = null;
@@ -939,8 +926,21 @@ var SafeSubscriber = (function (_super) {
};
return SafeSubscriber;
}(Subscriber));
-function isTrustedSubscriber(obj) {
- return obj instanceof Subscriber || ('_addParentTeardownLogic' in obj && obj[rxSubscriber]);
+
+function canReportError(observer) {
+ while (observer) {
+ var _a = observer, closed_1 = _a.closed, destination = _a.destination, isStopped = _a.isStopped;
+ if (closed_1 || isStopped) {
+ return false;
+ }
+ else if (destination && destination instanceof Subscriber) {
+ observer = destination;
+ }
+ else {
+ observer = null;
+ }
+ }
+ return true;
}
function toSubscriber(nextOrObserver, error, complete) {
@@ -1001,7 +1001,7 @@ var Observable = (function () {
operator.call(sink, this.source);
}
else {
- sink._addParentTeardownLogic(this.source || (config.useDeprecatedSynchronousErrorHandling && !sink.syncErrorThrowable) ?
+ sink.add(this.source || (config.useDeprecatedSynchronousErrorHandling && !sink.syncErrorThrowable) ?
this._subscribe(sink) :
this._trySubscribe(sink));
}
@@ -1024,7 +1024,12 @@ var Observable = (function () {
sink.syncErrorThrown = true;
sink.syncErrorValue = err;
}
- sink.error(err);
+ if (canReportError(sink)) {
+ sink.error(err);
+ }
+ else {
+ console.warn(err);
+ }
}
};
Observable.prototype.forEach = function (next, promiseCtor) {
@@ -2045,16 +2050,19 @@ var ObserveOnSubscriber = (function (_super) {
this.unsubscribe();
};
ObserveOnSubscriber.prototype.scheduleMessage = function (notification) {
- this.add(this.scheduler.schedule(ObserveOnSubscriber.dispatch, this.delay, new ObserveOnMessage(notification, this.destination)));
+ var destination = this.destination;
+ destination.add(this.scheduler.schedule(ObserveOnSubscriber.dispatch, this.delay, new ObserveOnMessage(notification, this.destination)));
};
ObserveOnSubscriber.prototype._next = function (value) {
this.scheduleMessage(Notification.createNext(value));
};
ObserveOnSubscriber.prototype._error = function (err) {
this.scheduleMessage(Notification.createError(err));
+ this.unsubscribe();
};
ObserveOnSubscriber.prototype._complete = function () {
this.scheduleMessage(Notification.createComplete());
+ this.unsubscribe();
};
return ObserveOnSubscriber;
}(Subscriber));
@@ -2566,7 +2574,12 @@ function bindCallback(callbackFunc, resultSelector, scheduler) {
callbackFunc.apply(context, args.concat([handler]));
}
catch (err) {
- subject.error(err);
+ if (canReportError(subject)) {
+ subject.error(err);
+ }
+ else {
+ console.warn(err);
+ }
}
}
return subject.subscribe(subscriber);
@@ -2661,7 +2674,12 @@ function bindNodeCallback(callbackFunc, resultSelector, scheduler) {
callbackFunc.apply(context, args.concat([handler]));
}
catch (err) {
- subject.error(err);
+ if (canReportError(subject)) {
+ subject.error(err);
+ }
+ else {
+ console.warn(err);
+ }
}
}
return subject.subscribe(subscriber);
@@ -3120,7 +3138,8 @@ var MergeMapSubscriber = (function (_super) {
};
MergeMapSubscriber.prototype._innerSub = function (ish, value, index) {
var innerSubscriber = new InnerSubscriber(this, undefined, undefined);
- this.add(innerSubscriber);
+ var destination = this.destination;
+ destination.add(innerSubscriber);
subscribeToResult(this, ish, value, index, innerSubscriber);
};
MergeMapSubscriber.prototype._complete = function () {
@@ -3128,6 +3147,7 @@ var MergeMapSubscriber = (function (_super) {
if (this.active === 0 && this.buffer.length === 0) {
this.destination.complete();
}
+ this.unsubscribe();
};
MergeMapSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
this.destination.next(innerValue);
@@ -3788,6 +3808,7 @@ var ZipSubscriber = (function (_super) {
ZipSubscriber.prototype._complete = function () {
var iterators = this.iterators;
var len = iterators.length;
+ this.unsubscribe();
if (len === 0) {
this.destination.complete();
return;
@@ -3796,7 +3817,8 @@ var ZipSubscriber = (function (_super) {
for (var i = 0; i < len; i++) {
var iterator$$1 = iterators[i];
if (iterator$$1.stillUnsubscribed) {
- this.add(iterator$$1.subscribe(iterator$$1, i));
+ var destination = this.destination;
+ destination.add(iterator$$1.subscribe(iterator$$1, i));
}
else {
this.active--;
@@ -4795,7 +4817,8 @@ var DelaySubscriber = (function (_super) {
};
DelaySubscriber.prototype._schedule = function (scheduler) {
this.active = true;
- this.add(scheduler.schedule(DelaySubscriber.dispatch, this.delay, {
+ var destination = this.destination;
+ destination.add(scheduler.schedule(DelaySubscriber.dispatch, this.delay, {
source: this, destination: this.destination, scheduler: scheduler
}));
};
@@ -4817,9 +4840,11 @@ var DelaySubscriber = (function (_super) {
this.errored = true;
this.queue = [];
this.destination.error(err);
+ this.unsubscribe();
};
DelaySubscriber.prototype._complete = function () {
this.scheduleNotification(Notification.createComplete());
+ this.unsubscribe();
};
return DelaySubscriber;
}(Subscriber));
@@ -4889,6 +4914,7 @@ var DelayWhenSubscriber = (function (_super) {
DelayWhenSubscriber.prototype._complete = function () {
this.completed = true;
this.tryComplete();
+ this.unsubscribe();
};
DelayWhenSubscriber.prototype.removeSubscription = function (subscription) {
subscription.unsubscribe();
@@ -4901,7 +4927,8 @@ var DelayWhenSubscriber = (function (_super) {
DelayWhenSubscriber.prototype.tryDelay = function (delayNotifier, value) {
var notifierSubscription = subscribeToResult(this, delayNotifier, value);
if (notifierSubscription && !notifierSubscription.closed) {
- this.add(notifierSubscription);
+ var destination = this.destination;
+ destination.add(notifierSubscription);
this.delayNotifierSubscriptions.push(notifierSubscription);
}
};
@@ -4942,6 +4969,7 @@ var SubscriptionDelaySubscriber = (function (_super) {
this.parent.error(err);
};
SubscriptionDelaySubscriber.prototype._complete = function () {
+ this.unsubscribe();
this.subscribeToSource();
};
SubscriptionDelaySubscriber.prototype.subscribeToSource = function () {
@@ -5438,7 +5466,8 @@ var ExhaustMapSubscriber = (function (_super) {
};
ExhaustMapSubscriber.prototype._innerSub = function (result, value, index) {
var innerSubscriber = new InnerSubscriber(this, undefined, undefined);
- this.add(innerSubscriber);
+ var destination = this.destination;
+ destination.add(innerSubscriber);
subscribeToResult(this, result, value, index, innerSubscriber);
};
ExhaustMapSubscriber.prototype._complete = function () {
@@ -5446,6 +5475,7 @@ var ExhaustMapSubscriber = (function (_super) {
if (!this.hasSubscription) {
this.destination.complete();
}
+ this.unsubscribe();
};
ExhaustMapSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
this.destination.next(innerValue);
@@ -5454,7 +5484,8 @@ var ExhaustMapSubscriber = (function (_super) {
this.destination.error(err);
};
ExhaustMapSubscriber.prototype.notifyComplete = function (innerSub) {
- this.remove(innerSub);
+ var destination = this.destination;
+ destination.remove(innerSub);
this.hasSubscription = false;
if (this.hasCompleted) {
this.destination.complete();
@@ -5517,7 +5548,8 @@ var ExpandSubscriber = (function (_super) {
}
else {
var state = { subscriber: this, result: result, value: value, index: index };
- this.add(this.scheduler.schedule(ExpandSubscriber.dispatch, 0, state));
+ var destination_1 = this.destination;
+ destination_1.add(this.scheduler.schedule(ExpandSubscriber.dispatch, 0, state));
}
}
else {
@@ -5526,20 +5558,23 @@ var ExpandSubscriber = (function (_super) {
};
ExpandSubscriber.prototype.subscribeToProjection = function (result, value, index) {
this.active++;
- this.add(subscribeToResult(this, result, value, index));
+ var destination = this.destination;
+ destination.add(subscribeToResult(this, result, value, index));
};
ExpandSubscriber.prototype._complete = function () {
this.hasCompleted = true;
if (this.hasCompleted && this.active === 0) {
this.destination.complete();
}
+ this.unsubscribe();
};
ExpandSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
this._next(innerValue);
};
ExpandSubscriber.prototype.notifyComplete = function (innerSub) {
var buffer = this.buffer;
- this.remove(innerSub);
+ var destination = this.destination;
+ destination.remove(innerSub);
this.active--;
if (buffer && buffer.length > 0) {
this._next(buffer.shift());
@@ -5885,9 +5920,7 @@ function reduce(accumulator, seed) {
};
}
return function reduceOperatorFunction(source) {
- return pipe(scan(function (acc, value, index) {
- return accumulator(acc, value, index + 1);
- }), takeLast(1))(source);
+ return pipe(scan(function (acc, value, index) { return accumulator(acc, value, index + 1); }), takeLast(1))(source);
};
}
@@ -5965,7 +5998,8 @@ var MergeScanSubscriber = (function (_super) {
};
MergeScanSubscriber.prototype._innerSub = function (ish, value, index) {
var innerSubscriber = new InnerSubscriber(this, undefined, undefined);
- this.add(innerSubscriber);
+ var destination = this.destination;
+ destination.add(innerSubscriber);
subscribeToResult(this, ish, value, index, innerSubscriber);
};
MergeScanSubscriber.prototype._complete = function () {
@@ -5976,6 +6010,7 @@ var MergeScanSubscriber = (function (_super) {
}
this.destination.complete();
}
+ this.unsubscribe();
};
MergeScanSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
var destination = this.destination;
@@ -5985,7 +6020,8 @@ var MergeScanSubscriber = (function (_super) {
};
MergeScanSubscriber.prototype.notifyComplete = function (innerSub) {
var buffer = this.buffer;
- this.remove(innerSub);
+ var destination = this.destination;
+ destination.remove(innerSub);
this.active--;
if (buffer.length > 0) {
this._next(buffer.shift());
@@ -6078,15 +6114,18 @@ var OnErrorResumeNextSubscriber = (function (_super) {
};
OnErrorResumeNextSubscriber.prototype._error = function (err) {
this.subscribeToNextSource();
+ this.unsubscribe();
};
OnErrorResumeNextSubscriber.prototype._complete = function () {
this.subscribeToNextSource();
+ this.unsubscribe();
};
OnErrorResumeNextSubscriber.prototype.subscribeToNextSource = function () {
var next = this.nextSources.shift();
if (next) {
var innerSubscriber = new InnerSubscriber(this, undefined, undefined);
- this.add(innerSubscriber);
+ var destination = this.destination;
+ destination.add(innerSubscriber);
subscribeToResult(this, next, undefined, undefined, innerSubscriber);
}
else {
@@ -6536,7 +6575,7 @@ var SequenceEqualSubscriber = (function (_super) {
_this._a = [];
_this._b = [];
_this._oneComplete = false;
- _this.add(compareTo.subscribe(new SequenceEqualCompareToSubscriber(destination, _this)));
+ _this.destination.add(compareTo.subscribe(new SequenceEqualCompareToSubscriber(destination, _this)));
return _this;
}
SequenceEqualSubscriber.prototype._next = function (value) {
@@ -6555,6 +6594,7 @@ var SequenceEqualSubscriber = (function (_super) {
else {
this._oneComplete = true;
}
+ this.unsubscribe();
};
SequenceEqualSubscriber.prototype.checkValues = function () {
var _c = this, _a = _c._a, _b = _c._b, comparor = _c.comparor;
@@ -6590,6 +6630,14 @@ var SequenceEqualSubscriber = (function (_super) {
this.checkValues();
}
};
+ SequenceEqualSubscriber.prototype.completeB = function () {
+ if (this._oneComplete) {
+ this.emit(this._a.length === 0 && this._b.length === 0);
+ }
+ else {
+ this._oneComplete = true;
+ }
+ };
return SequenceEqualSubscriber;
}(Subscriber));
var SequenceEqualCompareToSubscriber = (function (_super) {
@@ -6604,9 +6652,11 @@ var SequenceEqualCompareToSubscriber = (function (_super) {
};
SequenceEqualCompareToSubscriber.prototype._error = function (err) {
this.parent.error(err);
+ this.unsubscribe();
};
SequenceEqualCompareToSubscriber.prototype._complete = function () {
- this.parent._complete();
+ this.parent.completeB();
+ this.unsubscribe();
};
return SequenceEqualCompareToSubscriber;
}(Subscriber));
@@ -6620,7 +6670,7 @@ function share() {
function shareReplay(bufferSize, windowTime, scheduler) {
if (bufferSize === void 0) { bufferSize = Number.POSITIVE_INFINITY; }
- if (windowTime === void 0) { windowTime = Number.MAX_VALUE; }
+ if (windowTime === void 0) { windowTime = Number.POSITIVE_INFINITY; }
return function (source) { return source.lift(shareReplayOperator(bufferSize, windowTime, scheduler)); };
}
function shareReplayOperator(bufferSize, windowTime, scheduler) {
@@ -6997,7 +7047,8 @@ var SwitchMapSubscriber = (function (_super) {
innerSubscription.unsubscribe();
}
var innerSubscriber = new InnerSubscriber(this, undefined, undefined);
- this.add(innerSubscriber);
+ var destination = this.destination;
+ destination.add(innerSubscriber);
this.innerSubscription = subscribeToResult(this, result, value, index, innerSubscriber);
};
SwitchMapSubscriber.prototype._complete = function () {
@@ -7005,12 +7056,14 @@ var SwitchMapSubscriber = (function (_super) {
if (!innerSubscription || innerSubscription.closed) {
_super.prototype._complete.call(this);
}
+ this.unsubscribe();
};
SwitchMapSubscriber.prototype._unsubscribe = function () {
this.innerSubscription = null;
};
SwitchMapSubscriber.prototype.notifyComplete = function (innerSub) {
- this.remove(innerSub);
+ var destination = this.destination;
+ destination.remove(innerSub);
this.innerSubscription = null;
if (this.isStopped) {
_super.prototype._complete.call(this);