From 8a4162b1cfbe843e4a28d23b69744536a17b1033 Mon Sep 17 00:00:00 2001 From: Andre Medeiros Date: Fri, 23 Oct 2015 11:06:04 +0300 Subject: [PATCH] fix(skipUntil): unsubscribe source when it completes Fix operator skipUntil to automatically unsubscribe from its source whenever it completes. This is to conform RxJS Next with RxJS 4. Resolves issue #577. --- src/operators/skipUntil.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/operators/skipUntil.ts b/src/operators/skipUntil.ts index d7f9ac1268..ad283f7894 100644 --- a/src/operators/skipUntil.ts +++ b/src/operators/skipUntil.ts @@ -2,8 +2,8 @@ import Operator from '../Operator'; import Subscriber from '../Subscriber'; import Observable from '../Observable'; -export default function skipUntil(total) { - return this.lift(new SkipUntilOperator(total)); +export default function skipUntil(notifier: Observable): Observable { + return this.lift(new SkipUntilOperator(notifier)); } class SkipUntilOperator implements Operator { @@ -18,8 +18,9 @@ class SkipUntilOperator implements Operator { class SkipUntilSubscriber extends Subscriber { private notificationSubscriber: NotificationSubscriber = null; - constructor(destination: Subscriber, private notifier: Observable) { - super(destination); + constructor(public destination: Subscriber, + private notifier: Observable) { + super(null); this.notificationSubscriber = new NotificationSubscriber(this); this.add(this.notifier.subscribe(this.notificationSubscriber)); } @@ -30,6 +31,10 @@ class SkipUntilSubscriber extends Subscriber { } } + _error(err: any) { + this.destination.error(err); + } + _complete() { if (this.notificationSubscriber.hasCompleted) { this.destination.complete();