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.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. * ```javascript
  21. * const clicks = fromEvent(document, 'click');
  22. * const interval = interval(1000);
  23. * const result = clicks.pipe(
  24. * window(interval),
  25. * map(win => win.take(2)), // each window has at most 2 emissions
  26. * mergeAll(), // flatten the Observable-of-Observables
  27. * );
  28. * result.subscribe(x => console.log(x));
  29. * ```
  30. * @see {@link windowCount}
  31. * @see {@link windowTime}
  32. * @see {@link windowToggle}
  33. * @see {@link windowWhen}
  34. * @see {@link buffer}
  35. *
  36. * @param {Observable<any>} windowBoundaries An Observable that completes the
  37. * previous window and starts a new window.
  38. * @return {Observable<Observable<T>>} An Observable of windows, which are
  39. * Observables emitting values of the source Observable.
  40. * @method window
  41. * @owner Observable
  42. */
  43. export declare function window<T>(windowBoundaries: Observable<any>): OperatorFunction<T, Observable<T>>;