Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

takeLast.d.ts 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { 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. * ```javascript
  21. * const many = range(1, 100);
  22. * const lastThree = many.pipe(takeLast(3));
  23. * lastThree.subscribe(x => console.log(x));
  24. * ```
  25. *
  26. * @see {@link take}
  27. * @see {@link takeUntil}
  28. * @see {@link takeWhile}
  29. * @see {@link skip}
  30. *
  31. * @throws {ArgumentOutOfRangeError} When using `takeLast(i)`, it delivers an
  32. * ArgumentOutOrRangeError to the Observer's `error` callback if `i < 0`.
  33. *
  34. * @param {number} count The maximum number of values to emit from the end of
  35. * the sequence of values emitted by the source Observable.
  36. * @return {Observable<T>} An Observable that emits at most the last count
  37. * values emitted by the source Observable.
  38. * @method takeLast
  39. * @owner Observable
  40. */
  41. export declare function takeLast<T>(count: number): MonoTypeOperatorFunction<T>;