@@ -4,7 +4,8 @@ import { Observable } from '../Observable';
4
4
import { OuterSubscriber } from '../OuterSubscriber' ;
5
5
import { InnerSubscriber } from '../InnerSubscriber' ;
6
6
import { subscribeToResult } from '../util/subscribeToResult' ;
7
- import { MonoTypeOperatorFunction , TeardownLogic } from '../types' ;
7
+ import { MonoTypeOperatorFunction , TeardownLogic , ObservableInput } from '../types' ;
8
+ import { Subscription } from '../Subscription' ;
8
9
9
10
/**
10
11
* Returns an Observable that skips items emitted by the source Observable until a second Observable emits an item.
@@ -26,8 +27,8 @@ class SkipUntilOperator<T> implements Operator<T, T> {
26
27
constructor ( private notifier : Observable < any > ) {
27
28
}
28
29
29
- call ( subscriber : Subscriber < T > , source : any ) : TeardownLogic {
30
- return source . subscribe ( new SkipUntilSubscriber ( subscriber , this . notifier ) ) ;
30
+ call ( destination : Subscriber < T > , source : any ) : TeardownLogic {
31
+ return source . subscribe ( new SkipUntilSubscriber ( destination , this . notifier ) ) ;
31
32
}
32
33
}
33
34
@@ -39,12 +40,11 @@ class SkipUntilOperator<T> implements Operator<T, T> {
39
40
class SkipUntilSubscriber < T , R > extends OuterSubscriber < T , R > {
40
41
41
42
private hasValue : boolean = false ;
42
- private isInnerStopped : boolean = false ;
43
+ private innerSubscription : Subscription ;
43
44
44
- constructor ( destination : Subscriber < any > ,
45
- notifier : Observable < any > ) {
45
+ constructor ( destination : Subscriber < R > , notifier : ObservableInput < any > ) {
46
46
super ( destination ) ;
47
- this . add ( subscribeToResult ( this , notifier ) ) ;
47
+ this . add ( this . innerSubscription = subscribeToResult ( this , notifier ) ) ;
48
48
}
49
49
50
50
protected _next ( value : T ) {
@@ -53,24 +53,14 @@ class SkipUntilSubscriber<T, R> extends OuterSubscriber<T, R> {
53
53
}
54
54
}
55
55
56
- protected _complete ( ) {
57
- if ( this . isInnerStopped ) {
58
- super . _complete ( ) ;
59
- } else {
60
- this . unsubscribe ( ) ;
61
- }
62
- }
63
-
64
56
notifyNext ( outerValue : T , innerValue : R ,
65
57
outerIndex : number , innerIndex : number ,
66
58
innerSub : InnerSubscriber < T , R > ) : void {
67
59
this . hasValue = true ;
60
+ this . innerSubscription . unsubscribe ( ) ;
68
61
}
69
62
70
- notifyComplete ( ) : void {
71
- this . isInnerStopped = true ;
72
- if ( this . isStopped ) {
73
- super . _complete ( ) ;
74
- }
63
+ notifyComplete ( ) {
64
+ /* do nothing */
75
65
}
76
66
}
0 commit comments