1.0.1 • Published 5 years ago

callbag-latest-batch v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

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)) 
)