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.

buffer.d.ts 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { Observable } from '../Observable';
  2. import { OperatorFunction } from '../types';
  3. /**
  4. * Buffers the source Observable values until `closingNotifier` emits.
  5. *
  6. * <span class="informal">Collects values from the past as an array, and emits
  7. * that array only when another Observable emits.</span>
  8. *
  9. * ![](buffer.png)
  10. *
  11. * Buffers the incoming Observable values until the given `closingNotifier`
  12. * Observable emits a value, at which point it emits the buffer on the output
  13. * Observable and starts a new buffer internally, awaiting the next time
  14. * `closingNotifier` emits.
  15. *
  16. * ## Example
  17. *
  18. * On every click, emit array of most recent interval events
  19. *
  20. * ```javascript
  21. * const clicks = fromEvent(document, 'click');
  22. * const interval = interval(1000);
  23. * const buffered = interval.pipe(buffer(clicks));
  24. * buffered.subscribe(x => console.log(x));
  25. * ```
  26. *
  27. * @see {@link bufferCount}
  28. * @see {@link bufferTime}
  29. * @see {@link bufferToggle}
  30. * @see {@link bufferWhen}
  31. * @see {@link window}
  32. *
  33. * @param {Observable<any>} closingNotifier An Observable that signals the
  34. * buffer to be emitted on the output Observable.
  35. * @return {Observable<T[]>} An Observable of buffers, which are arrays of
  36. * values.
  37. * @method buffer
  38. * @owner Observable
  39. */
  40. export declare function buffer<T>(closingNotifier: Observable<any>): OperatorFunction<T, T[]>;