wishthis/node_modules/rxjs/_esm2015/internal/operators/takeUntil.js

31 lines
1 KiB
JavaScript
Raw Normal View History

2022-05-29 09:24:36 +00:00
import { innerSubscribe, SimpleInnerSubscriber, SimpleOuterSubscriber } from '../innerSubscribe';
export function takeUntil(notifier) {
return (source) => source.lift(new TakeUntilOperator(notifier));
}
class TakeUntilOperator {
constructor(notifier) {
this.notifier = notifier;
}
call(subscriber, source) {
const takeUntilSubscriber = new TakeUntilSubscriber(subscriber);
const notifierSubscription = innerSubscribe(this.notifier, new SimpleInnerSubscriber(takeUntilSubscriber));
if (notifierSubscription && !takeUntilSubscriber.seenValue) {
takeUntilSubscriber.add(notifierSubscription);
return source.subscribe(takeUntilSubscriber);
}
return takeUntilSubscriber;
}
}
class TakeUntilSubscriber extends SimpleOuterSubscriber {
constructor(destination) {
super(destination);
this.seenValue = false;
}
notifyNext() {
this.seenValue = true;
this.complete();
}
notifyComplete() {
}
}
//# sourceMappingURL=takeUntil.js.map