3fde7d353d6bdba9e396d3a8c9560c475e3c87e6197ac1f2022b965ec706cdfd6471a3004a21140682f3c0dcccf25edfafc1dc90dc0d5d41bff64cb5eac19d 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import { MonoTypeOperatorFunction, ObservableInput } from '../types';
  2. /**
  3. * Returns an Observable that skips items emitted by the source Observable until a second Observable emits an item.
  4. *
  5. * The `skipUntil` operator causes the observable stream to skip the emission of values until the passed in observable
  6. * emits the first value. This can be particularly useful in combination with user interactions, responses of HTTP
  7. * requests or waiting for specific times to pass by.
  8. *
  9. * ![](skipUntil.png)
  10. *
  11. * Internally, the `skipUntil` operator subscribes to the passed in `notifier` `ObservableInput` (which gets converted
  12. * to an Observable) in order to recognize the emission of its first value. When `notifier` emits next, the operator
  13. * unsubscribes from it and starts emitting the values of the *source* observable until it completes or errors. It
  14. * will never let the *source* observable emit any values if the `notifier` completes or throws an error without
  15. * emitting a value before.
  16. *
  17. * ## Example
  18. *
  19. * In the following example, all emitted values of the interval observable are skipped until the user clicks anywhere
  20. * within the page
  21. *
  22. * ```ts
  23. * import { interval, fromEvent, skipUntil } from 'rxjs';
  24. *
  25. * const intervalObservable = interval(1000);
  26. * const click = fromEvent(document, 'click');
  27. *
  28. * const emitAfterClick = intervalObservable.pipe(
  29. * skipUntil(click)
  30. * );
  31. * // clicked at 4.6s. output: 5...6...7...8........ or
  32. * // clicked at 7.3s. output: 8...9...10..11.......
  33. * emitAfterClick.subscribe(value => console.log(value));
  34. * ```
  35. *
  36. * @see {@link last}
  37. * @see {@link skip}
  38. * @see {@link skipWhile}
  39. * @see {@link skipLast}
  40. *
  41. * @param notifier An `ObservableInput` that has to emit an item before the source Observable elements begin to
  42. * be mirrored by the resulting Observable.
  43. * @return A function that returns an Observable that skips items from the
  44. * source Observable until the `notifier` Observable emits an item, then emits the
  45. * remaining items.
  46. */
  47. export declare function skipUntil<T>(notifier: ObservableInput<any>): MonoTypeOperatorFunction<T>;
  48. //# sourceMappingURL=skipUntil.d.ts.map