Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

takeUntil.js 1.1KB

1234567891011121314151617181920212223242526272829303132
  1. import { OuterSubscriber } from '../OuterSubscriber';
  2. import { subscribeToResult } from '../util/subscribeToResult';
  3. export function takeUntil(notifier) {
  4. return (source) => source.lift(new TakeUntilOperator(notifier));
  5. }
  6. class TakeUntilOperator {
  7. constructor(notifier) {
  8. this.notifier = notifier;
  9. }
  10. call(subscriber, source) {
  11. const takeUntilSubscriber = new TakeUntilSubscriber(subscriber);
  12. const notifierSubscription = subscribeToResult(takeUntilSubscriber, this.notifier);
  13. if (notifierSubscription && !takeUntilSubscriber.seenValue) {
  14. takeUntilSubscriber.add(notifierSubscription);
  15. return source.subscribe(takeUntilSubscriber);
  16. }
  17. return takeUntilSubscriber;
  18. }
  19. }
  20. class TakeUntilSubscriber extends OuterSubscriber {
  21. constructor(destination) {
  22. super(destination);
  23. this.seenValue = false;
  24. }
  25. notifyNext(outerValue, innerValue, outerIndex, innerIndex, innerSub) {
  26. this.seenValue = true;
  27. this.complete();
  28. }
  29. notifyComplete() {
  30. }
  31. }
  32. //# sourceMappingURL=takeUntil.js.map