UNPKG

1.61 kBTypeScriptView Raw
1import { MonoTypeOperatorFunction } from '../types';
2/**
3 * Skip a specified number of values before the completion of an observable.
4 *
5 * ![](skipLast.png)
6 *
7 * Returns an observable that will emit values as soon as it can, given a number of
8 * skipped values. For example, if you `skipLast(3)` on a source, when the source
9 * emits its fourth value, the first value the source emitted will finally be emitted
10 * from the returned observable, as it is no longer part of what needs to be skipped.
11 *
12 * All values emitted by the result of `skipLast(N)` will be delayed by `N` emissions,
13 * as each value is held in a buffer until enough values have been emitted that that
14 * the buffered value may finally be sent to the consumer.
15 *
16 * After subscribing, unsubscribing will not result in the emission of the buffered
17 * skipped values.
18 *
19 * ## Example
20 *
21 * Skip the last 2 values of an observable with many values
22 *
23 * ```ts
24 * import { of, skipLast } from 'rxjs';
25 *
26 * const numbers = of(1, 2, 3, 4, 5);
27 * const skipLastTwo = numbers.pipe(skipLast(2));
28 * skipLastTwo.subscribe(x => console.log(x));
29 *
30 * // Results in:
31 * // 1 2 3
32 * // (4 and 5 are skipped)
33 * ```
34 *
35 * @see {@link skip}
36 * @see {@link skipUntil}
37 * @see {@link skipWhile}
38 * @see {@link take}
39 *
40 * @param skipCount Number of elements to skip from the end of the source Observable.
41 * @return A function that returns an Observable that skips the last `count`
42 * values emitted by the source Observable.
43 */
44export declare function skipLast<T>(skipCount: number): MonoTypeOperatorFunction<T>;
45//# sourceMappingURL=skipLast.d.ts.map
\No newline at end of file