This is a modification of pull-infinite.
tick( generete, period )
where:
generate
is somefunction()
that generates dataperiod
is the period with which this happens (in ms)
Tick returns a pull-source.
var pull = require('pull-stream')
var tick = require('pull-tick')
pull(
tick( () => 'tick', 1000 ),
pull.take(20),
pull.drain(
(data) => console.log(Date.now(), `received ${data}`),
() => console.log('thank god the ticking has stopped')
)
)
Note the useful pull.take, which allows us to take only the first n
of the possible infinite ticks.