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.

window.d.ts 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { Observable } from '../Observable';
  2. import { OperatorFunction } from '../types';
  3. /**
  4. * Branch out the source Observable values as a nested Observable whenever
  5. * `windowBoundaries` emits.
  6. *
  7. * <span class="informal">It's like {@link buffer}, but emits a nested Observable
  8. * instead of an array.</span>
  9. *
  10. * ![](window.png)
  11. *
  12. * Returns an Observable that emits windows of items it collects from the source
  13. * Observable. The output Observable emits connected, non-overlapping
  14. * windows. It emits the current window and opens a new one whenever the
  15. * Observable `windowBoundaries` emits an item. Because each window is an
  16. * Observable, the output is a higher-order Observable.
  17. *
  18. * ## Example
  19. * In every window of 1 second each, emit at most 2 click events
  20. * ```ts
  21. * import { fromEvent, interval } from 'rxjs';
  22. * import { window, mergeAll, map, take } from 'rxjs/operators';
  23. *
  24. * const clicks = fromEvent(document, 'click');
  25. * const sec = interval(1000);
  26. * const result = clicks.pipe(
  27. * window(sec),
  28. * map(win => win.pipe(take(2))), // each window has at most 2 emissions
  29. * mergeAll(), // flatten the Observable-of-Observables
  30. * );
  31. * result.subscribe(x => console.log(x));
  32. * ```
  33. * @see {@link windowCount}
  34. * @see {@link windowTime}
  35. * @see {@link windowToggle}
  36. * @see {@link windowWhen}
  37. * @see {@link buffer}
  38. *
  39. * @param {Observable<any>} windowBoundaries An Observable that completes the
  40. * previous window and starts a new window.
  41. * @return {Observable<Observable<T>>} An Observable of windows, which are
  42. * Observables emitting values of the source Observable.
  43. * @method window
  44. * @owner Observable
  45. */
  46. export declare function window<T>(windowBoundaries: Observable<any>): OperatorFunction<T, Observable<T>>;