The TimeInterval operator intercepts the items from the source Observable and emits in their place objects that indicate the amount of time that elapsed between pairs of emissions.
See AlsoThe timeInterval operator converts a source Observable into an Observable that emits indications of the amount of time lapsed between consecutive emissions of the source Observable. The first emission from this new Observable indicates the amount of time lapsed between the time when the observer subscribed to the Observable and the time when the source Observable emitted its first item. There is no corresponding emission marking the amount of time lapsed between the last emission of the source Observable and the subsequent call to onCompleted
.
timeInterval
by default operates on the computation
Scheduler, but also has a variant that allows you to specify the Scheduler by passing it in as a parameter.
timeInterval()
timeInterval(Scheduler)
The timeInterval operator converts a source Observable into an Observable that emits indications of the amount of time lapsed between consecutive emissions of the source Observable. The first emission from this new Observable indicates the amount of time lapsed between the time when the observer subscribed to the Observable and the time when the source Observable emitted its first item. There is no corresponding emission marking the amount of time lapsed between the last emission of the source Observable and the subsequent call to onCompleted
.
timeInterval
by default operates on the computation
Scheduler, but also has a variant that allows you to specify the Scheduler by passing it in as a parameter.
timeInterval()
timeInterval(Scheduler)
The timeInterval
operator converts a source Observable into an Observable that emits indications of the amount of time lapsed between consecutive emissions of the source Observable. The first emission from this new Observable indicates the amount of time lapsed between the time when the observer subscribed to the Observable and the time when the source Observable emitted its first item. There is no corresponding emission marking the amount of time lapsed between the last emission of the source Observable and the subsequent call to onCompleted
.
var source = Rx.Observable.timer(0, 1000) .timeInterval() .map(function (x) { return x.value + ':' + x.interval; }) .take(5); var subscription = source.subscribe( function (x) { console.log('Next: ' + x); }, function (err) { console.log('Error: ' + err); }, function () { console.log('Completed'); });
Next: 0:0 Next: 1:1000 Next: 2:1000 Next: 3:1000 Next: 4:1000 Completed
timeInterval
by default operates on the timeout
Scheduler, but also has a variant that allows you to specify the Scheduler by passing it in as a parameter.
timeInterval
is found in each of the following distributions:
rx.all.js
rx.all.compat.js
rx.time.js
(requires rx.js
or rx.compat.js
)rx.lite.js
rx.lite.compat.js
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4