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 1.5KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /** PURE_IMPORTS_START tslib,_OuterSubscriber,_util_subscribeToResult PURE_IMPORTS_END */
  2. import * as tslib_1 from "tslib";
  3. import { OuterSubscriber } from '../OuterSubscriber';
  4. import { subscribeToResult } from '../util/subscribeToResult';
  5. export function buffer(closingNotifier) {
  6. return function bufferOperatorFunction(source) {
  7. return source.lift(new BufferOperator(closingNotifier));
  8. };
  9. }
  10. var BufferOperator = /*@__PURE__*/ (function () {
  11. function BufferOperator(closingNotifier) {
  12. this.closingNotifier = closingNotifier;
  13. }
  14. BufferOperator.prototype.call = function (subscriber, source) {
  15. return source.subscribe(new BufferSubscriber(subscriber, this.closingNotifier));
  16. };
  17. return BufferOperator;
  18. }());
  19. var BufferSubscriber = /*@__PURE__*/ (function (_super) {
  20. tslib_1.__extends(BufferSubscriber, _super);
  21. function BufferSubscriber(destination, closingNotifier) {
  22. var _this = _super.call(this, destination) || this;
  23. _this.buffer = [];
  24. _this.add(subscribeToResult(_this, closingNotifier));
  25. return _this;
  26. }
  27. BufferSubscriber.prototype._next = function (value) {
  28. this.buffer.push(value);
  29. };
  30. BufferSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
  31. var buffer = this.buffer;
  32. this.buffer = [];
  33. this.destination.next(buffer);
  34. };
  35. return BufferSubscriber;
  36. }(OuterSubscriber));
  37. //# sourceMappingURL=buffer.js.map