BACK
ReferencebufferWhen
Reference · 44

bufferWhen

bufferWhen

rxjs.dev

Collects values until a closing factory ends the buffer.

Signature

bufferWhen(closingSelector: () => ObservableInput): OperatorFunction

What it does

Creates a buffer and calls closingSelector for a closing Observable. When it emits, the current array is sent and the next buffer opens.

When to use

When the batch boundary is computed dynamically: a user pause, external state, manually closing the current window.

See also

buffer, bufferToggle, windowWhen

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