c3fe3832d033bf361505d4e2b3c0422c68142a406896e1cc53618e4325a1d4a2a899e12571308f66a4ed28b70732da9ff5b1a579aee47540ad3c832d8ac23f 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import { Observable } from '../Observable';
  2. import { MonoTypeOperatorFunction, ObservableInput } from '../types';
  3. /**
  4. * Returns an Observable that mirrors the source Observable with the exception of a `complete`. If the source
  5. * Observable calls `complete`, this method will emit to the Observable returned from `notifier`. If that Observable
  6. * calls `complete` or `error`, then this method will call `complete` or `error` on the child subscription. Otherwise
  7. * this method will resubscribe to the source Observable.
  8. *
  9. * ![](repeatWhen.png)
  10. *
  11. * ## Example
  12. *
  13. * Repeat a message stream on click
  14. *
  15. * ```ts
  16. * import { of, fromEvent, repeatWhen } from 'rxjs';
  17. *
  18. * const source = of('Repeat message');
  19. * const documentClick$ = fromEvent(document, 'click');
  20. *
  21. * const result = source.pipe(repeatWhen(() => documentClick$));
  22. *
  23. * result.subscribe(data => console.log(data))
  24. * ```
  25. *
  26. * @see {@link repeat}
  27. * @see {@link retry}
  28. * @see {@link retryWhen}
  29. *
  30. * @param notifier Function that receives an Observable of notifications with
  31. * which a user can `complete` or `error`, aborting the repetition.
  32. * @return A function that returns an Observable that mirrors the source
  33. * Observable with the exception of a `complete`.
  34. * @deprecated Will be removed in v9 or v10. Use {@link repeat}'s {@link RepeatConfig#delay delay} option instead.
  35. * Instead of `repeatWhen(() => notify$)`, use: `repeat({ delay: () => notify$ })`.
  36. */
  37. export declare function repeatWhen<T>(notifier: (notifications: Observable<void>) => ObservableInput<any>): MonoTypeOperatorFunction<T>;
  38. //# sourceMappingURL=repeatWhen.d.ts.map