TakeLast
Waits for the source to complete, then emits the last N values from the source, as specified by the count argument.
takeLast<T>(count: number): MonoTypeOperatorFunction<T>
Parameters | Description |
---|---|
count | The maximum number of values to emit from the end of the sequence of values emitted by the source Observable. |
MonoTypeOperatorFunction
Take the last 3 values of an Observable with many values
import { range } from 'rxjs';
import { takeLast } from 'rxjs/operators';
const many = range(1, 100);
const lastThree = many.pipe(takeLast(3));
lastThree.subscribe(x => console.log(x));