This is RxJS v 4. Find the latest version here
Returns elements within the specified duration from the end of the observable source sequence, using the specified schedulers to run timers and to drain the collected elements.
duration
(Number
): Duration for taking elements from the end of the sequence.[timeScheduler=Rx.Scheduler.timeout]
(Scheduler
): Scheduler to run the timer on. If not specified, defaults to timeout scheduler.[loopScheduler=Rx.Scheduler.currentThread]
(Scheduler
): Scheduler to drain the collected elements. If not specified, defaults to current thread scheduler.
(Observable
): An observable sequence with the elements taken during the specified duration from the end of the source sequence.
var source = Rx.Observable.timer(0, 1000)
.take(10)
.takeLastWithTime(5000);
var subscription = source.subscribe(
function (x) {
console.log('Next: ' + x);
},
function (err) {
console.log('Error: ' + err);
},
function () {
console.log('Completed');
});
// => Next: 5
// => Next: 6
// => Next: 7
// => Next: 8
// => Next: 9
// => Completed
File:
Dist:
Prerequisites:
- If using
rx.time.js
NPM Packages:
NuGet Packages:
Unit Tests: