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.

take.d.ts 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import { MonoTypeOperatorFunction } from '../types';
  2. /**
  3. * Emits only the first `count` values emitted by the source Observable.
  4. *
  5. * <span class="informal">Takes the first `count` values from the source, then
  6. * completes.</span>
  7. *
  8. * ![](take.png)
  9. *
  10. * `take` returns an Observable that emits only the first `count` values emitted
  11. * by the source Observable. If the source emits fewer than `count` values then
  12. * all of its values are emitted. After that, it completes, regardless if the
  13. * source completes.
  14. *
  15. * ## Example
  16. * Take the first 5 seconds of an infinite 1-second interval Observable
  17. * ```ts
  18. * import { interval } from 'rxjs';
  19. * import { take } from 'rxjs/operators';
  20. *
  21. * const intervalCount = interval(1000);
  22. * const takeFive = intervalCount.pipe(take(5));
  23. * takeFive.subscribe(x => console.log(x));
  24. *
  25. * // Logs:
  26. * // 0
  27. * // 1
  28. * // 2
  29. * // 3
  30. * // 4
  31. * ```
  32. *
  33. * @see {@link takeLast}
  34. * @see {@link takeUntil}
  35. * @see {@link takeWhile}
  36. * @see {@link skip}
  37. *
  38. * @throws {ArgumentOutOfRangeError} When using `take(i)`, it delivers an
  39. * ArgumentOutOrRangeError to the Observer's `error` callback if `i < 0`.
  40. *
  41. * @param {number} count The maximum number of `next` values to emit.
  42. * @return {Observable<T>} An Observable that emits only the first `count`
  43. * values emitted by the source Observable, or all of the values from the source
  44. * if the source emits fewer than `count` values.
  45. * @method take
  46. * @owner Observable
  47. */
  48. export declare function take<T>(count: number): MonoTypeOperatorFunction<T>;