475cd36817cef24e54a4eaa770adac5e2d114e82c54187fb0b78f436d5df996ebe37db7dd8b20ff8a6f18fe51d27b49b08c9034eb4af2118f330a844385238 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { MonoTypeOperatorFunction, ObservableInput } from '../types';
  2. /**
  3. * Emits the values emitted by the source Observable until a `notifier`
  4. * Observable emits a value.
  5. *
  6. * <span class="informal">Lets values pass until a second Observable,
  7. * `notifier`, emits a value. Then, it completes.</span>
  8. *
  9. * ![](takeUntil.png)
  10. *
  11. * `takeUntil` subscribes and begins mirroring the source Observable. It also
  12. * monitors a second Observable, `notifier` that you provide. If the `notifier`
  13. * emits a value, the output Observable stops mirroring the source Observable
  14. * and completes. If the `notifier` doesn't emit any value and completes
  15. * then `takeUntil` will pass all values.
  16. *
  17. * ## Example
  18. *
  19. * Tick every second until the first click happens
  20. *
  21. * ```ts
  22. * import { interval, fromEvent, takeUntil } from 'rxjs';
  23. *
  24. * const source = interval(1000);
  25. * const clicks = fromEvent(document, 'click');
  26. * const result = source.pipe(takeUntil(clicks));
  27. * result.subscribe(x => console.log(x));
  28. * ```
  29. *
  30. * @see {@link take}
  31. * @see {@link takeLast}
  32. * @see {@link takeWhile}
  33. * @see {@link skip}
  34. *
  35. * @param notifier The `ObservableInput` whose first emitted value will cause the output
  36. * Observable of `takeUntil` to stop emitting values from the source Observable.
  37. * @return A function that returns an Observable that emits the values from the
  38. * source Observable until `notifier` emits its first value.
  39. */
  40. export declare function takeUntil<T>(notifier: ObservableInput<any>): MonoTypeOperatorFunction<T>;
  41. //# sourceMappingURL=takeUntil.d.ts.map