skip to content

timeInterval

 

Indicates time passed since previous value emission

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
const { rxObserver } = require('api/v0.3');
const { interval, merge } = require('rxjs');
const { timeInterval, take, map } = require('rxjs/operators');

merge(
  interval(5),
  interval(7)
)
  .pipe(
    take(10),
    timeInterval(),
    map(({ interval }) => `+${interval}`)
  )
  .subscribe(rxObserver(''));

0msstartcomplete+5+5 +2+2 +3+3 +4+4 +1+1 +5+5 +1+1 +4+4 +3+3 +2+2