Home

Awesome

flyd-timeInterval

Travis npm David David

Records the time interval between consecutive values emitted from a stream.

Signature

Stream -> Stream

Usage

import every from 'flyd-every';
import timeInterval from 'flyd-timeinterval';

const stream = every(INTERVAL),
      intervalStream = timeInterval(stream);

flyd.stream([intervalStream, stream], () => {
  console.log('Interval:', intervalStream().interval, ', Time:', intervalStream().time);
});

// Interval: 0 , Time: 1434814906566
// Interval: 200 , Time: 1434814906767
// Interval: 200 , Time: 1434814906967
// Interval: 200 , Time: 1434814907167
// Interval: 199 , Time: 1434814907366