1 import { OperatorFunction } from '../types';
3 * Buffers the source Observable values until the size hits the maximum
6 * <span class="informal">Collects values from the past as an array, and emits
7 * that array only when its size reaches `bufferSize`.</span>
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.
19 * Emit the last two click events as an array
22 * import { fromEvent } from 'rxjs';
23 * import { bufferCount } from 'rxjs/operators';
25 * const clicks = fromEvent(document, 'click');
26 * const buffered = clicks.pipe(bufferCount(2));
27 * buffered.subscribe(x => console.log(x));
30 * On every click, emit the last two click events as an array
33 * import { fromEvent } from 'rxjs';
34 * import { bufferCount } from 'rxjs/operators';
36 * const clicks = fromEvent(document, 'click');
37 * const buffered = clicks.pipe(bufferCount(2, 1));
38 * buffered.subscribe(x => console.log(x));
42 * @see {@link bufferTime}
43 * @see {@link bufferToggle}
44 * @see {@link bufferWhen}
45 * @see {@link pairwise}
46 * @see {@link windowCount}
48 * @param {number} bufferSize The maximum size of the buffer emitted.
49 * @param {number} [startBufferEvery] Interval at which to start a new buffer.
50 * For example if `startBufferEvery` is `2`, then a new buffer will be started
51 * on every other value from the source. A new buffer is started at the
52 * beginning of the source by default.
53 * @return {Observable<T[]>} An Observable of arrays of buffered values.
57 export declare function bufferCount<T>(bufferSize: number, startBufferEvery?: number): OperatorFunction<T, T[]>;