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.

shareReplay.d.ts 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import { MonoTypeOperatorFunction, SchedulerLike } from '../types';
  2. /**
  3. * Share source and replay specified number of emissions on subscription.
  4. *
  5. * This operator is a specialization of `replay` that connects to a source observable
  6. * and multicasts through a `ReplaySubject` constructed with the specified arguments.
  7. * A successfully completed source will stay cached in the `shareReplayed observable` forever,
  8. * but an errored source can be retried.
  9. *
  10. * ## Why use shareReplay?
  11. * You generally want to use `shareReplay` when you have side-effects or taxing computations
  12. * that you do not wish to be executed amongst multiple subscribers.
  13. * It may also be valuable in situations where you know you will have late subscribers to
  14. * a stream that need access to previously emitted values.
  15. * This ability to replay values on subscription is what differentiates {@link share} and `shareReplay`.
  16. *
  17. * ![](shareReplay.png)
  18. *
  19. * ## Example
  20. * ```javascript
  21. * const obs$ = interval(1000);
  22. * const subscription = obs$.pipe(
  23. * take(4),
  24. * shareReplay(3)
  25. * );
  26. * subscription.subscribe(x => console.log('source A: ', x));
  27. * subscription.subscribe(y => console.log('source B: ', y));
  28. *
  29. * ```
  30. *
  31. * @see {@link publish}
  32. * @see {@link share}
  33. * @see {@link publishReplay}
  34. *
  35. * @param {Number} [bufferSize=Number.POSITIVE_INFINITY] Maximum element count of the replay buffer.
  36. * @param {Number} [windowTime=Number.POSITIVE_INFINITY] Maximum time length of the replay buffer in milliseconds.
  37. * @param {Scheduler} [scheduler] Scheduler where connected observers within the selector function
  38. * will be invoked on.
  39. * @return {Observable} An observable sequence that contains the elements of a sequence produced
  40. * by multicasting the source sequence within a selector function.
  41. * @method shareReplay
  42. * @owner Observable
  43. */
  44. export declare function shareReplay<T>(bufferSize?: number, windowTime?: number, scheduler?: SchedulerLike): MonoTypeOperatorFunction<T>;