callbag-latest-batch

1.0.1 • Public • Published

callbag-latest-batch

Callbag operator that turns a listenable source into a pullable source, emiting all the data since the last request batched within an array, if any.

Much like callbag-latest but one that collects all the interim data.

npm version Build Status

example

const interval = require('callbag-interval')
const sample = require('callbag-sample')
const pipe = require('callbag-pipe')
const latestBatch = require('callbag-latest-batch')
 
const randomStream = pipe( // random numbers generated every second
  interval(1000),
  map(() => Math.floor(Math.random()*100))
)
 
const submitActionStream = pipe( // collected into arrays every five seconds
  interval(5000),
  sample(latestBatch(randomStream)) 
)

Package Sidebar

Install

npm i callbag-latest-batch

Weekly Downloads

5

Version

1.0.1

License

ISC

Unpacked Size

3.04 kB

Total Files

5

Last publish

Collaborators

  • scio