38 lines
No EOL
1.2 KiB
JavaScript
38 lines
No EOL
1.2 KiB
JavaScript
import { OuterSubscriber } from '../OuterSubscriber';
|
|
import { InnerSubscriber } from '../InnerSubscriber';
|
|
import { subscribeToResult } from '../util/subscribeToResult';
|
|
export function skipUntil(notifier) {
|
|
return (source) => source.lift(new SkipUntilOperator(notifier));
|
|
}
|
|
class SkipUntilOperator {
|
|
constructor(notifier) {
|
|
this.notifier = notifier;
|
|
}
|
|
call(destination, source) {
|
|
return source.subscribe(new SkipUntilSubscriber(destination, this.notifier));
|
|
}
|
|
}
|
|
class SkipUntilSubscriber extends OuterSubscriber {
|
|
constructor(destination, notifier) {
|
|
super(destination);
|
|
this.hasValue = false;
|
|
const innerSubscriber = new InnerSubscriber(this, undefined, undefined);
|
|
this.add(innerSubscriber);
|
|
this.innerSubscription = innerSubscriber;
|
|
subscribeToResult(this, notifier, undefined, undefined, innerSubscriber);
|
|
}
|
|
_next(value) {
|
|
if (this.hasValue) {
|
|
super._next(value);
|
|
}
|
|
}
|
|
notifyNext(outerValue, innerValue, outerIndex, innerIndex, innerSub) {
|
|
this.hasValue = true;
|
|
if (this.innerSubscription) {
|
|
this.innerSubscription.unsubscribe();
|
|
}
|
|
}
|
|
notifyComplete() {
|
|
}
|
|
}
|
|
//# sourceMappingURL=skipUntil.js.map
|