Skip to content

Commit

Permalink
refactor(takeUntil): use new operate function.
Browse files Browse the repository at this point in the history
  • Loading branch information
benlesh committed May 16, 2023
1 parent 134bca4 commit 48a47dd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/internal/operators/takeUntil.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MonoTypeOperatorFunction, ObservableInput } from '../types';
import { Observable } from '../Observable';
import { createOperatorSubscriber } from './OperatorSubscriber';
import { operate } from '../Subscriber';
import { from } from '../observable/from';
import { noop } from '../util/noop';

Expand Down Expand Up @@ -44,8 +44,8 @@ import { noop } from '../util/noop';
*/
export function takeUntil<T>(notifier: ObservableInput<any>): MonoTypeOperatorFunction<T> {
return (source) =>
new Observable((subscriber) => {
from(notifier).subscribe(createOperatorSubscriber(subscriber, () => subscriber.complete(), noop));
!subscriber.closed && source.subscribe(subscriber);
new Observable((destination) => {
from(notifier).subscribe(operate({ destination, next: () => destination.complete(), complete: noop }));
!destination.closed && source.subscribe(destination);
});
}

0 comments on commit 48a47dd

Please sign in to comment.