BACK
Referencebuffer
Reference · 41

buffer

Collects values until another Observable says "flush".

Signature

buffer(closingNotifier: ObservableInput): OperatorFunction

Marble diagram

source: a-b-c-|, close: ------  →  [a,b,c]

What it does

Collects the source's values into an array. When closingNotifier emits, the array is sent on and a new buffer begins; when the source completes, the current buffer is sent too.

When to use

Batching user events, accumulating changes until a save signal, collecting clicks until submit/blur.

See also

bufferCount, bufferTime, bufferWhen

script.ts // TypeScript
CONSOLE · Console output
Hit Run to see the result...