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.

bufferCount.d.ts 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import { OperatorFunction } from '../types';
  2. /**
  3. * Buffers the source Observable values until the size hits the maximum
  4. * `bufferSize` given.
  5. *
  6. * <span class="informal">Collects values from the past as an array, and emits
  7. * that array only when its size reaches `bufferSize`.</span>
  8. *
  9. * ![](bufferCount.png)
  10. *
  11. * Buffers a number of values from the source Observable by `bufferSize` then
  12. * emits the buffer and clears it, and starts a new buffer each
  13. * `startBufferEvery` values. If `startBufferEvery` is not provided or is
  14. * `null`, then new buffers are started immediately at the start of the source
  15. * and when each buffer closes and is emitted.
  16. *
  17. * ## Examples
  18. *
  19. * Emit the last two click events as an array
  20. *
  21. * ```javascript
  22. * const clicks = fromEvent(document, 'click');
  23. * const buffered = clicks.pipe(bufferCount(2));
  24. * buffered.subscribe(x => console.log(x));
  25. * ```
  26. *
  27. * On every click, emit the last two click events as an array
  28. *
  29. * ```javascript
  30. * const clicks = fromEvent(document, 'click');
  31. * const buffered = clicks.pipe(bufferCount(2, 1));
  32. * buffered.subscribe(x => console.log(x));
  33. * ```
  34. *
  35. * @see {@link buffer}
  36. * @see {@link bufferTime}
  37. * @see {@link bufferToggle}
  38. * @see {@link bufferWhen}
  39. * @see {@link pairwise}
  40. * @see {@link windowCount}
  41. *
  42. * @param {number} bufferSize The maximum size of the buffer emitted.
  43. * @param {number} [startBufferEvery] Interval at which to start a new buffer.
  44. * For example if `startBufferEvery` is `2`, then a new buffer will be started
  45. * on every other value from the source. A new buffer is started at the
  46. * beginning of the source by default.
  47. * @return {Observable<T[]>} An Observable of arrays of buffered values.
  48. * @method bufferCount
  49. * @owner Observable
  50. */
  51. export declare function bufferCount<T>(bufferSize: number, startBufferEvery?: number): OperatorFunction<T, T[]>;