pnpm install --save xstream-buffer-time
Emits buffered values over a set time-interval
import xs from 'xstream'
import fromDiagram from 'xstream/extra/fromDiagram'
import bufferTime from 'xstream-buffer-time'
const stream = xs.periodic(50).take(8)
.compose(bufferTime(200))
stream.addListener({
next: i => console.log(i),
error: err => console.error(err),
complete: () => console.log('completed')
})
> starting
> [0, 1, 2] (after 200 ms)
> [3, 4, 5, 6] (after 400 ms)
> completed
MIT