Skip to main content
100%

RxJS buffer function calls

✓ Published0🌍 Public
RRestuta
Last edited Feb 6, 2018
Created on Feb 6, 2018

This example demonstrates how RxJS can batch function calls into buffered groups using the `Subject` API. The code creates a `bufferTime` operator that collects invocations over 500 milliseconds, up to a maximum of three items, before emitting them as an array. A custom `batchify` helper subscribes to the buffered observable and logs each batch of arguments before passing them to the target function. The main loop asynchronously invokes the batched function with increasing numbers, then quickly fires three more calls to trigger a final buffered output.

AI-generated description

Similar vizzes