summaryrefslogtreecommitdiff
path: root/tools/node_modules/eslint/node_modules/rxjs/src/internal/Subscriber.ts
diff options
context:
space:
mode:
Diffstat (limited to 'tools/node_modules/eslint/node_modules/rxjs/src/internal/Subscriber.ts')
-rw-r--r--tools/node_modules/eslint/node_modules/rxjs/src/internal/Subscriber.ts33
1 files changed, 5 insertions, 28 deletions
diff --git a/tools/node_modules/eslint/node_modules/rxjs/src/internal/Subscriber.ts b/tools/node_modules/eslint/node_modules/rxjs/src/internal/Subscriber.ts
index d7dd3c84de..40dd3522c0 100644
--- a/tools/node_modules/eslint/node_modules/rxjs/src/internal/Subscriber.ts
+++ b/tools/node_modules/eslint/node_modules/rxjs/src/internal/Subscriber.ts
@@ -45,7 +45,7 @@ export class Subscriber<T> extends Subscription implements Observer<T> {
/** @internal */ syncErrorThrowable: boolean = false;
protected isStopped: boolean = false;
- protected destination: PartialObserver<any>; // this `any` is the escape hatch to erase extra type param (e.g. R)
+ protected destination: PartialObserver<any> | Subscriber<any>; // this `any` is the escape hatch to erase extra type param (e.g. R)
private _parentSubscription: Subscription | null = null;
@@ -72,13 +72,10 @@ export class Subscriber<T> extends Subscription implements Observer<T> {
break;
}
if (typeof destinationOrNext === 'object') {
- // HACK(benlesh): For situations where Node has multiple copies of rxjs in
- // node_modules, we cannot rely on `instanceof` checks
- if (isTrustedSubscriber(destinationOrNext)) {
- const trustedSubscriber = destinationOrNext[rxSubscriberSymbol]() as Subscriber<any>;
- 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;
this.destination = new SafeSubscriber<T>(this, <PartialObserver<any>> destinationOrNext);
@@ -116,7 +113,6 @@ export class Subscriber<T> extends Subscription implements Observer<T> {
if (!this.isStopped) {
this.isStopped = true;
this._error(err);
- this._unsubscribeParentSubscription();
}
}
@@ -130,7 +126,6 @@ export class Subscriber<T> extends Subscription implements Observer<T> {
if (!this.isStopped) {
this.isStopped = true;
this._complete();
- this._unsubscribeParentSubscription();
}
}
@@ -157,20 +152,6 @@ export class Subscriber<T> extends Subscription implements Observer<T> {
}
/** @deprecated This is an internal implementation detail, do not use. */
- _addParentTeardownLogic(parentTeardownLogic: TeardownLogic) {
- if (parentTeardownLogic !== this) {
- this._parentSubscription = this.add(parentTeardownLogic);
- }
- }
-
- /** @deprecated This is an internal implementation detail, do not use. */
- _unsubscribeParentSubscription() {
- if (this._parentSubscription !== null) {
- this._parentSubscription.unsubscribe();
- }
- }
-
- /** @deprecated This is an internal implementation detail, do not use. */
_unsubscribeAndRecycle(): Subscriber<T> {
const { _parent, _parents } = this;
this._parent = null;
@@ -324,7 +305,3 @@ export class SafeSubscriber<T> extends Subscriber<T> {
_parentSubscriber.unsubscribe();
}
}
-
-function isTrustedSubscriber(obj: any) {
- return obj instanceof Subscriber || ('_addParentTeardownLogic' in obj && obj[rxSubscriberSymbol]);
-}