BufferizeOptions<T, R>
Defined in: src/Bufferize.ts:12
Options of bufferize: how items are accumulated and when the accumulated
value is emitted.
Type Parameters
T
T
the type of the incoming items
R
R
the type of the accumulated (and emitted) value
Properties
getInitialValue
getInitialValue: () =>
R
Defined in: src/Bufferize.ts:14
Creates the initial accumulator: at the start and, unless getNextInitialValue is set, after every flush.
Returns
R
getNextInitialValue?
optionalgetNextInitialValue?: (acc) =>R
Defined in: src/Bufferize.ts:16
Creates the accumulator that follows a flush; defaults to getInitialValue.
Parameters
acc
R
Returns
R
reducer
reducer: (
acc,value) =>R
Defined in: src/Bufferize.ts:18
Folds an incoming item into the accumulator.
Parameters
acc
R
value
T
Returns
R
shouldFlush?
optionalshouldFlush?: (acc,value,bufferizedItemsCount) =>boolean
Defined in: src/Bufferize.ts:20
Decides whether to emit the accumulator after an item; the third argument is the number of items accumulated so far. Defaults to never.
Parameters
acc
R
value
T
bufferizedItemsCount
number
Returns
boolean
timeFrame?
optionaltimeFrame?:number
Defined in: src/Bufferize.ts:22
Emits the accumulator this many milliseconds after its first item, even if shouldFlush did not fire.