a zip code crypto-currency system good for red ONLY

buffer.js 1.4KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import { buffer as higherOrder } from '../operators/buffer';
  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 function buffer(closingNotifier) {
  35. return higherOrder(closingNotifier)(this);
  36. }
  37. //# sourceMappingURL=buffer.js.map