The skipLastWithTime
operator takes a temporal duration rather than a quantity of
items. It drops those items that are emitted during that final duration of the source
Observable’s lifespan. You set this duration by passing in a number of milliseconds as a parameter
to skipLastWithTime
.
Note that the mechanism by which this is implemented will delay the emission of any item from the source
Observable until the given duration passes since its emission.
skipLastWithTime
by default operates on the timeout
Scheduler, but you may also pass in a Scheduler of your choosing as an
optional second parameter.
Sample Code
var source = Rx.Observable.timer(0, 1000)
.take(10)
.skipLastWithTime(5000);
var subscription = source.subscribe(
function (x) { console.log('Next: ' + x); },
function (err) { console.log('Error: ' + err); },
function () { console.log('Completed'); });
Next: 0
Next: 1
Next: 2
Next: 3
Next: 4
Completed
skipLastWithTime
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