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.

windowCount.d.ts 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import { Observable } from '../Observable';
  2. import { OperatorFunction } from '../types';
  3. /**
  4. * Branch out the source Observable values as a nested Observable with each
  5. * nested Observable emitting at most `windowSize` values.
  6. *
  7. * <span class="informal">It's like {@link bufferCount}, but emits a nested
  8. * Observable instead of an array.</span>
  9. *
  10. * ![](windowCount.png)
  11. *
  12. * Returns an Observable that emits windows of items it collects from the source
  13. * Observable. The output Observable emits windows every `startWindowEvery`
  14. * items, each containing no more than `windowSize` items. When the source
  15. * Observable completes or encounters an error, the output Observable emits
  16. * the current window and propagates the notification from the source
  17. * Observable. If `startWindowEvery` is not provided, then new windows are
  18. * started immediately at the start of the source and when each window completes
  19. * with size `windowSize`.
  20. *
  21. * ## Examples
  22. * Ignore every 3rd click event, starting from the first one
  23. * ```javascript
  24. * const clicks = fromEvent(document, 'click');
  25. * const result = clicks.pipe(
  26. * windowCount(3)),
  27. * map(win => win.skip(1)), // skip first of every 3 clicks
  28. * mergeAll(), // flatten the Observable-of-Observables
  29. * );
  30. * result.subscribe(x => console.log(x));
  31. * ```
  32. *
  33. * Ignore every 3rd click event, starting from the third one
  34. * ```javascript
  35. * const clicks = fromEvent(document, 'click');
  36. * const result = clicks.pipe(
  37. * windowCount(2, 3),
  38. * mergeAll(), // flatten the Observable-of-Observables
  39. * );
  40. * result.subscribe(x => console.log(x));
  41. * ```
  42. *
  43. * @see {@link window}
  44. * @see {@link windowTime}
  45. * @see {@link windowToggle}
  46. * @see {@link windowWhen}
  47. * @see {@link bufferCount}
  48. *
  49. * @param {number} windowSize The maximum number of values emitted by each
  50. * window.
  51. * @param {number} [startWindowEvery] Interval at which to start a new window.
  52. * For example if `startWindowEvery` is `2`, then a new window will be started
  53. * on every other value from the source. A new window is started at the
  54. * beginning of the source by default.
  55. * @return {Observable<Observable<T>>} An Observable of windows, which in turn
  56. * are Observable of values.
  57. * @method windowCount
  58. * @owner Observable
  59. */
  60. export declare function windowCount<T>(windowSize: number, startWindowEvery?: number): OperatorFunction<T, Observable<T>>;