Front end of the Slack clone application.

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