blob: 6ab63ae6e34fed27779fd7a609998b904c82f71a [file] [log] [blame]
/** PURE_IMPORTS_START tslib,_OuterSubscriber,_util_subscribeToResult PURE_IMPORTS_END */
import * as tslib_1 from "tslib";
import { OuterSubscriber } from '../OuterSubscriber';
import { subscribeToResult } from '../util/subscribeToResult';
export function buffer(closingNotifier) {
return function bufferOperatorFunction(source) {
return source.lift(new BufferOperator(closingNotifier));
};
}
var BufferOperator = /*@__PURE__*/ (function () {
function BufferOperator(closingNotifier) {
this.closingNotifier = closingNotifier;
}
BufferOperator.prototype.call = function (subscriber, source) {
return source.subscribe(new BufferSubscriber(subscriber, this.closingNotifier));
};
return BufferOperator;
}());
var BufferSubscriber = /*@__PURE__*/ (function (_super) {
tslib_1.__extends(BufferSubscriber, _super);
function BufferSubscriber(destination, closingNotifier) {
var _this = _super.call(this, destination) || this;
_this.buffer = [];
_this.add(subscribeToResult(_this, closingNotifier));
return _this;
}
BufferSubscriber.prototype._next = function (value) {
this.buffer.push(value);
};
BufferSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
var buffer = this.buffer;
this.buffer = [];
this.destination.next(buffer);
};
return BufferSubscriber;
}(OuterSubscriber));
//# sourceMappingURL=buffer.js.map