takeLast
Emits only the last count
values emitted by the source Observable.
Parameters
count |
The maximum number of values to emit from the end of the sequence of values emitted by the source Observable. |
Returns
MonoTypeOperatorFunction<T>
: An Observable that emits at most the last count
values emitted by the source Observable.
Throws
ArgumentOutOfRangeError
When using takeLast(i)
, it delivers an
ArgumentOutOrRangeError to the Observer's error
callback if i < 0
.
Description
Remembers the latest count
values, then emits those
only when the source completes.
takeLast
returns an Observable that emits at most the last count
values
emitted by the source Observable. If the source emits fewer than count
values then all of its values are emitted. This operator must wait until the
complete
notification emission from the source in order to emit the next
values on the output Observable, because otherwise it is impossible to know
whether or not more values will be emitted on the source. For this reason,
all values are emitted synchronously, followed by the complete notification.
Example
Take the last 3 values of an Observable with many values