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.js 1019B

12345678910111213141516171819202122232425262728293031
  1. import { OuterSubscriber } from '../OuterSubscriber';
  2. import { subscribeToResult } from '../util/subscribeToResult';
  3. export function buffer(closingNotifier) {
  4. return function bufferOperatorFunction(source) {
  5. return source.lift(new BufferOperator(closingNotifier));
  6. };
  7. }
  8. class BufferOperator {
  9. constructor(closingNotifier) {
  10. this.closingNotifier = closingNotifier;
  11. }
  12. call(subscriber, source) {
  13. return source.subscribe(new BufferSubscriber(subscriber, this.closingNotifier));
  14. }
  15. }
  16. class BufferSubscriber extends OuterSubscriber {
  17. constructor(destination, closingNotifier) {
  18. super(destination);
  19. this.buffer = [];
  20. this.add(subscribeToResult(this, closingNotifier));
  21. }
  22. _next(value) {
  23. this.buffer.push(value);
  24. }
  25. notifyNext(outerValue, innerValue, outerIndex, innerIndex, innerSub) {
  26. const buffer = this.buffer;
  27. this.buffer = [];
  28. this.destination.next(buffer);
  29. }
  30. }
  31. //# sourceMappingURL=buffer.js.map