source: trip-planner-front/node_modules/rxjs/internal/operators/takeLast.d.ts@ bdd6491

Last change on this file since bdd6491 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.7 KB
Line 
1import { MonoTypeOperatorFunction } from '../types';
2/**
3 * Emits only the last `count` values emitted by the source Observable.
4 *
5 * <span class="informal">Remembers the latest `count` values, then emits those
6 * only when the source completes.</span>
7 *
8 * ![](takeLast.png)
9 *
10 * `takeLast` returns an Observable that emits at most the last `count` values
11 * emitted by the source Observable. If the source emits fewer than `count`
12 * values then all of its values are emitted. This operator must wait until the
13 * `complete` notification emission from the source in order to emit the `next`
14 * values on the output Observable, because otherwise it is impossible to know
15 * whether or not more values will be emitted on the source. For this reason,
16 * all values are emitted synchronously, followed by the complete notification.
17 *
18 * ## Example
19 * Take the last 3 values of an Observable with many values
20 * ```ts
21 * import { range } from 'rxjs';
22 * import { takeLast } from 'rxjs/operators';
23 *
24 * const many = range(1, 100);
25 * const lastThree = many.pipe(takeLast(3));
26 * lastThree.subscribe(x => console.log(x));
27 * ```
28 *
29 * @see {@link take}
30 * @see {@link takeUntil}
31 * @see {@link takeWhile}
32 * @see {@link skip}
33 *
34 * @throws {ArgumentOutOfRangeError} When using `takeLast(i)`, it delivers an
35 * ArgumentOutOrRangeError to the Observer's `error` callback if `i < 0`.
36 *
37 * @param {number} count The maximum number of values to emit from the end of
38 * the sequence of values emitted by the source Observable.
39 * @return {Observable<T>} An Observable that emits at most the last count
40 * values emitted by the source Observable.
41 * @method takeLast
42 * @owner Observable
43 */
44export declare function takeLast<T>(count: number): MonoTypeOperatorFunction<T>;
Note: See TracBrowser for help on using the repository browser.