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.

timeInterval.d.ts 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import { SchedulerLike, OperatorFunction } from '../types';
  2. /**
  3. *
  4. * Emits an object containing the current value, and the time that has
  5. * passed between emitting the current value and the previous value, which is
  6. * calculated by using the provided `scheduler`'s `now()` method to retrieve
  7. * the current time at each emission, then calculating the difference. The `scheduler`
  8. * defaults to {@link asyncScheduler}, so by default, the `interval` will be in
  9. * milliseconds.
  10. *
  11. * <span class="informal">Convert an Observable that emits items into one that
  12. * emits indications of the amount of time elapsed between those emissions.</span>
  13. *
  14. * ![](timeinterval.png)
  15. *
  16. * ## Examples
  17. * Emit inteval between current value with the last value
  18. *
  19. * ```ts
  20. * const seconds = interval(1000);
  21. *
  22. * seconds.pipe(timeinterval())
  23. * .subscribe(
  24. * value => console.log(value),
  25. * err => console.log(err),
  26. * );
  27. *
  28. * seconds.pipe(timeout(900))
  29. * .subscribe(
  30. * value => console.log(value),
  31. * err => console.log(err),
  32. * );
  33. *
  34. * // NOTE: The values will never be this precise,
  35. * // intervals created with `interval` or `setInterval`
  36. * // are non-deterministic.
  37. *
  38. * // {value: 0, interval: 1000}
  39. * // {value: 1, interval: 1000}
  40. * // {value: 2, interval: 1000}
  41. * ```
  42. *
  43. * @param {SchedulerLike} [scheduler] Scheduler used to get the current time.
  44. * @return {Observable<{ interval: number, value: T }>} Observable that emit infomation about value and interval
  45. * @method timeInterval
  46. */
  47. export declare function timeInterval<T>(scheduler?: SchedulerLike): OperatorFunction<T, TimeInterval<T>>;
  48. /**
  49. * @deprecated exposed API, use as interface only.
  50. */
  51. export declare class TimeInterval<T> {
  52. value: T;
  53. interval: number;
  54. constructor(value: T, interval: number);
  55. }