a zip code crypto-currency system good for red ONLY

buffer.js 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /** PURE_IMPORTS_START .._operators_buffer PURE_IMPORTS_END */
  2. import { buffer as higherOrder } from '../operators/buffer';
  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. * <img src="./img/buffer.png" width="100%">
  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 <caption>On every click, emit array of most recent interval events</caption>
  17. * var clicks = Rx.Observable.fromEvent(document, 'click');
  18. * var interval = Rx.Observable.interval(1000);
  19. * var buffered = interval.buffer(clicks);
  20. * buffered.subscribe(x => console.log(x));
  21. *
  22. * @see {@link bufferCount}
  23. * @see {@link bufferTime}
  24. * @see {@link bufferToggle}
  25. * @see {@link bufferWhen}
  26. * @see {@link window}
  27. *
  28. * @param {Observable<any>} closingNotifier An Observable that signals the
  29. * buffer to be emitted on the output Observable.
  30. * @return {Observable<T[]>} An Observable of buffers, which are arrays of
  31. * values.
  32. * @method buffer
  33. * @owner Observable
  34. */
  35. export function buffer(closingNotifier) {
  36. return higherOrder(closingNotifier)(this);
  37. }
  38. //# sourceMappingURL=buffer.js.map