frontend/.pnpm-store/v3/files/b5/99de9425fccd113ba335b0da84a4c57658012559cece5a1723beab3145ef529bca91cf04b55e63bb8ac7313eaa42ee8c9d967dbca01f67fcab44f7a439f3eb

31 lines
1.0 KiB
Plaintext

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