/** PURE_IMPORTS_START tslib,_scheduler_async,_Subscriber,_util_isScheduler PURE_IMPORTS_END */ import * as tslib_1 from "tslib"; import { async } from '../scheduler/async'; import { Subscriber } from '../Subscriber'; import { isScheduler } from '../util/isScheduler'; export function bufferTime(bufferTimeSpan) { var length = arguments.length; var scheduler = async; if (isScheduler(arguments[arguments.length - 1])) { scheduler = arguments[arguments.length - 1]; length--; } var bufferCreationInterval = null; if (length >= 2) { bufferCreationInterval = arguments[1]; } var maxBufferSize = Number.POSITIVE_INFINITY; if (length >= 3) { maxBufferSize = arguments[2]; } return function bufferTimeOperatorFunction(source) { return source.lift(new BufferTimeOperator(bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler)); }; } var BufferTimeOperator = /*@__PURE__*/ (function () { function BufferTimeOperator(bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler) { this.bufferTimeSpan = bufferTimeSpan; this.bufferCreationInterval = bufferCreationInterval; this.maxBufferSize = maxBufferSize; this.scheduler = scheduler; } BufferTimeOperator.prototype.call = function (subscriber, source) { return source.subscribe(new BufferTimeSubscriber(subscriber, this.bufferTimeSpan, this.bufferCreationInterval, this.maxBufferSize, this.scheduler)); }; return BufferTimeOperator; }()); var Context = /*@__PURE__*/ (function () { function Context() { this.buffer = []; } return Context; }()); var BufferTimeSubscriber = /*@__PURE__*/ (function (_super) { tslib_1.__extends(BufferTimeSubscriber, _super); function BufferTimeSubscriber(destination, bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler) { var _this = _super.call(this, destination) || this; _this.bufferTimeSpan = bufferTimeSpan; _this.bufferCreationInterval = bufferCreationInterval; _this.maxBufferSize = maxBufferSize; _this.scheduler = scheduler; _this.contexts = []; var context = _this.openContext(); _this.timespanOnly = bufferCreationInterval == null || bufferCreationInterval < 0; if (_this.timespanOnly) { var timeSpanOnlyState = { subscriber: _this, context: context, bufferTimeSpan: bufferTimeSpan }; _this.add(context.closeAction = scheduler.schedule(dispatchBufferTimeSpanOnly, bufferTimeSpan, timeSpanOnlyState)); } else { var closeState = { subscriber: _this, context: context }; var creationState = { bufferTimeSpan: bufferTimeSpan, bufferCreationInterval: bufferCreationInterval, subscriber: _this, scheduler: scheduler }; _this.add(context.closeAction = scheduler.schedule(dispatchBufferClose, bufferTimeSpan, closeState)); _this.add(scheduler.schedule(dispatchBufferCreation, bufferCreationInterval, creationState)); } return _this; } BufferTimeSubscriber.prototype._next = function (value) { var contexts = this.contexts; var len = contexts.length; var filledBufferContext; for (var i = 0; i < len; i++) { var context_1 = contexts[i]; var buffer = context_1.buffer; buffer.push(value); if (buffer.length == this.maxBufferSize) { filledBufferContext = context_1; } } if (filledBufferContext) { this.onBufferFull(filledBufferContext); } }; BufferTimeSubscriber.prototype._error = function (err) { this.contexts.length = 0; _super.prototype._error.call(this, err); }; BufferTimeSubscriber.prototype._complete = function () { var _a = this, contexts = _a.contexts, destination = _a.destination; while (contexts.length > 0) { var context_2 = contexts.shift(); destination.next(context_2.buffer); } _super.prototype._complete.call(this); }; BufferTimeSubscriber.prototype._unsubscribe = function () { this.contexts = null; }; BufferTimeSubscriber.prototype.onBufferFull = function (context) { this.closeContext(context); var closeAction = context.closeAction; closeAction.unsubscribe(); this.remove(closeAction); if (!this.closed && this.timespanOnly) { context = this.openContext(); var bufferTimeSpan = this.bufferTimeSpan; var timeSpanOnlyState = { subscriber: this, context: context, bufferTimeSpan: bufferTimeSpan }; this.add(context.closeAction = this.scheduler.schedule(dispatchBufferTimeSpanOnly, bufferTimeSpan, timeSpanOnlyState)); } }; BufferTimeSubscriber.prototype.openContext = function () { var context = new Context(); this.contexts.push(context); return context; }; BufferTimeSubscriber.prototype.closeContext = function (context) { this.destination.next(context.buffer); var contexts = this.contexts; var spliceIndex = contexts ? contexts.indexOf(context) : -1; if (spliceIndex >= 0) { contexts.splice(contexts.indexOf(context), 1); } }; return BufferTimeSubscriber; }(Subscriber)); function dispatchBufferTimeSpanOnly(state) { var subscriber = state.subscriber; var prevContext = state.context; if (prevContext) { subscriber.closeContext(prevContext); } if (!subscriber.closed) { state.context = subscriber.openContext(); state.context.closeAction = this.schedule(state, state.bufferTimeSpan); } } function dispatchBufferCreation(state) { var bufferCreationInterval = state.bufferCreationInterval, bufferTimeSpan = state.bufferTimeSpan, subscriber = state.subscriber, scheduler = state.scheduler; var context = subscriber.openContext(); var action = this; if (!subscriber.closed) { subscriber.add(context.closeAction = scheduler.schedule(dispatchBufferClose, bufferTimeSpan, { subscriber: subscriber, context: context })); action.schedule(state, bufferCreationInterval); } } function dispatchBufferClose(arg) { var subscriber = arg.subscriber, context = arg.context; subscriber.closeContext(context); } //# sourceMappingURL=bufferTime.js.map
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
audit.js | File | 2.47 KB | 0644 |
|
audit.js.map | File | 1.79 KB | 0644 |
|
auditTime.js | File | 431 B | 0644 |
|
auditTime.js.map | File | 407 B | 0644 |
|
buffer.js | File | 1.4 KB | 0644 |
|
buffer.js.map | File | 1.04 KB | 0644 |
|
bufferCount.js | File | 3.39 KB | 0644 |
|
bufferCount.js.map | File | 2.46 KB | 0644 |
|
bufferTime.js | File | 6.32 KB | 0644 |
|
bufferTime.js.map | File | 5.16 KB | 0644 |
|
bufferToggle.js | File | 4.24 KB | 0644 |
|
bufferToggle.js.map | File | 3.38 KB | 0644 |
|
bufferWhen.js | File | 2.9 KB | 0644 |
|
bufferWhen.js.map | File | 2.09 KB | 0644 |
|
catchError.js | File | 1.83 KB | 0644 |
|
catchError.js.map | File | 1.39 KB | 0644 |
|
combineAll.js | File | 307 B | 0644 |
|
combineAll.js.map | File | 310 B | 0644 |
|
combineLatest.js | File | 855 B | 0644 |
|
combineLatest.js.map | File | 822 B | 0644 |
|
concat.js | File | 431 B | 0644 |
|
concat.js.map | File | 371 B | 0644 |
|
concatAll.js | File | 186 B | 0644 |
|
concatAll.js.map | File | 228 B | 0644 |
|
concatMap.js | File | 234 B | 0644 |
|
concatMap.js.map | File | 272 B | 0644 |
|
concatMapTo.js | File | 279 B | 0644 |
|
concatMapTo.js.map | File | 286 B | 0644 |
|
count.js | File | 1.72 KB | 0644 |
|
count.js.map | File | 1.41 KB | 0644 |
|
debounce.js | File | 2.74 KB | 0644 |
|
debounce.js.map | File | 2.06 KB | 0644 |
|
debounceTime.js | File | 2.43 KB | 0644 |
|
debounceTime.js.map | File | 1.81 KB | 0644 |
|
defaultIfEmpty.js | File | 1.48 KB | 0644 |
|
defaultIfEmpty.js.map | File | 1.02 KB | 0644 |
|
delay.js | File | 3.4 KB | 0644 |
|
delay.js.map | File | 3.04 KB | 0644 |
|
delayWhen.js | File | 5.3 KB | 0644 |
|
delayWhen.js.map | File | 3.7 KB | 0644 |
|
dematerialize.js | File | 1.01 KB | 0644 |
|
dematerialize.js.map | File | 675 B | 0644 |
|
distinct.js | File | 2.25 KB | 0644 |
|
distinct.js.map | File | 1.74 KB | 0644 |
|
distinctUntilChanged.js | File | 2.15 KB | 0644 |
|
distinctUntilChanged.js.map | File | 1.62 KB | 0644 |
|
distinctUntilKeyChanged.js | File | 354 B | 0644 |
|
distinctUntilKeyChanged.js.map | File | 463 B | 0644 |
|
elementAt.js | File | 832 B | 0644 |
|
elementAt.js.map | File | 790 B | 0644 |
|
endWith.js | File | 424 B | 0644 |
|
endWith.js.map | File | 385 B | 0644 |
|
every.js | File | 1.81 KB | 0644 |
|
every.js.map | File | 1.51 KB | 0644 |
|
exhaust.js | File | 1.61 KB | 0644 |
|
exhaust.js.map | File | 1.11 KB | 0644 |
|
exhaustMap.js | File | 2.98 KB | 0644 |
|
exhaustMap.js.map | File | 2.45 KB | 0644 |
|
expand.js | File | 3.74 KB | 0644 |
|
expand.js.map | File | 3.06 KB | 0644 |
|
filter.js | File | 1.45 KB | 0644 |
|
filter.js.map | File | 1.16 KB | 0644 |
|
finalize.js | File | 1.01 KB | 0644 |
|
finalize.js.map | File | 764 B | 0644 |
|
find.js | File | 2.26 KB | 0644 |
|
find.js.map | File | 1.83 KB | 0644 |
|
findIndex.js | File | 313 B | 0644 |
|
findIndex.js.map | File | 350 B | 0644 |
|
first.js | File | 763 B | 0644 |
|
first.js.map | File | 822 B | 0644 |
|
groupBy.js | File | 6.59 KB | 0644 |
|
groupBy.js.map | File | 4.97 KB | 0644 |
|
ignoreElements.js | File | 1019 B | 0644 |
|
ignoreElements.js.map | File | 592 B | 0644 |
|
index.js | File | 4.09 KB | 0644 |
|
index.js.map | File | 4.24 KB | 0644 |
|
isEmpty.js | File | 1.17 KB | 0644 |
|
isEmpty.js.map | File | 858 B | 0644 |
|
last.js | File | 777 B | 0644 |
|
last.js.map | File | 820 B | 0644 |
|
map.js | File | 1.52 KB | 0644 |
|
map.js.map | File | 1.22 KB | 0644 |
|
mapTo.js | File | 1009 B | 0644 |
|
mapTo.js.map | File | 794 B | 0644 |
|
materialize.js | File | 1.46 KB | 0644 |
|
materialize.js.map | File | 1.05 KB | 0644 |
|
max.js | File | 341 B | 0644 |
|
max.js.map | File | 533 B | 0644 |
|
merge.js | File | 424 B | 0644 |
|
merge.js.map | File | 369 B | 0644 |
|
mergeAll.js | File | 359 B | 0644 |
|
mergeAll.js.map | File | 330 B | 0644 |
|
mergeMap.js | File | 3.66 KB | 0644 |
|
mergeMap.js.map | File | 3.03 KB | 0644 |
|
mergeMapTo.js | File | 604 B | 0644 |
|
mergeMapTo.js.map | File | 520 B | 0644 |
|
mergeScan.js | File | 3.5 KB | 0644 |
|
mergeScan.js.map | File | 2.81 KB | 0644 |
|
min.js | File | 341 B | 0644 |
|
min.js.map | File | 533 B | 0644 |
|
multicast.js | File | 1.5 KB | 0644 |
|
multicast.js.map | File | 1.1 KB | 0644 |
|
observeOn.js | File | 2.56 KB | 0644 |
|
observeOn.js.map | File | 1.77 KB | 0644 |
|
onErrorResumeNext.js | File | 3 KB | 0644 |
|
onErrorResumeNext.js.map | File | 2.12 KB | 0644 |
|
pairwise.js | File | 1.17 KB | 0644 |
|
pairwise.js.map | File | 907 B | 0644 |
|
partition.js | File | 385 B | 0644 |
|
partition.js.map | File | 424 B | 0644 |
|
pluck.js | File | 902 B | 0644 |
|
pluck.js.map | File | 929 B | 0644 |
|
publish.js | File | 341 B | 0644 |
|
publish.js.map | File | 384 B | 0644 |
|
publishBehavior.js | File | 341 B | 0644 |
|
publishBehavior.js.map | File | 361 B | 0644 |
|
publishLast.js | File | 311 B | 0644 |
|
publishLast.js.map | File | 333 B | 0644 |
|
publishReplay.js | File | 686 B | 0644 |
|
publishReplay.js.map | File | 649 B | 0644 |
|
race.js | File | 625 B | 0644 |
|
race.js.map | File | 555 B | 0644 |
|
reduce.js | File | 718 B | 0644 |
|
reduce.js.map | File | 790 B | 0644 |
|
refCount.js | File | 2.01 KB | 0644 |
|
refCount.js.map | File | 1.49 KB | 0644 |
|
repeat.js | File | 1.73 KB | 0644 |
|
repeat.js.map | File | 1.35 KB | 0644 |
|
repeatWhen.js | File | 3.2 KB | 0644 |
|
repeatWhen.js.map | File | 2.22 KB | 0644 |
|
retry.js | File | 1.45 KB | 0644 |
|
retry.js.map | File | 1.13 KB | 0644 |
|
retryWhen.js | File | 2.84 KB | 0644 |
|
retryWhen.js.map | File | 2.1 KB | 0644 |
|
sample.js | File | 1.64 KB | 0644 |
|
sample.js.map | File | 1.17 KB | 0644 |
|
sampleTime.js | File | 1.82 KB | 0644 |
|
sampleTime.js.map | File | 1.41 KB | 0644 |
|
scan.js | File | 2.2 KB | 0644 |
|
scan.js.map | File | 1.78 KB | 0644 |
|
sequenceEqual.js | File | 3.91 KB | 0644 |
|
sequenceEqual.js.map | File | 3.05 KB | 0644 |
|
share.js | File | 407 B | 0644 |
|
share.js.map | File | 431 B | 0644 |
|
shareReplay.js | File | 2.09 KB | 0644 |
|
shareReplay.js.map | File | 1.68 KB | 0644 |
|
single.js | File | 2.29 KB | 0644 |
|
single.js.map | File | 1.85 KB | 0644 |
|
skip.js | File | 1.04 KB | 0644 |
|
skip.js.map | File | 849 B | 0644 |
|
skipLast.js | File | 1.81 KB | 0644 |
|
skipLast.js.map | File | 1.42 KB | 0644 |
|
skipUntil.js | File | 1.82 KB | 0644 |
|
skipUntil.js.map | File | 1.28 KB | 0644 |
|
skipWhile.js | File | 1.56 KB | 0644 |
|
skipWhile.js.map | File | 1.22 KB | 0644 |
|
startWith.js | File | 631 B | 0644 |
|
startWith.js.map | File | 615 B | 0644 |
|
subscribeOn.js | File | 829 B | 0644 |
|
subscribeOn.js.map | File | 657 B | 0644 |
|
switchAll.js | File | 257 B | 0644 |
|
switchAll.js.map | File | 271 B | 0644 |
|
switchMap.js | File | 2.95 KB | 0644 |
|
switchMap.js.map | File | 2.34 KB | 0644 |
|
switchMapTo.js | File | 349 B | 0644 |
|
switchMapTo.js.map | File | 361 B | 0644 |
|
take.js | File | 1.58 KB | 0644 |
|
take.js.map | File | 1.23 KB | 0644 |
|
takeLast.js | File | 2.14 KB | 0644 |
|
takeLast.js.map | File | 1.83 KB | 0644 |
|
takeUntil.js | File | 1.53 KB | 0644 |
|
takeUntil.js.map | File | 1.03 KB | 0644 |
|
takeWhile.js | File | 1.9 KB | 0644 |
|
takeWhile.js.map | File | 1.44 KB | 0644 |
|
tap.js | File | 2.56 KB | 0644 |
|
tap.js.map | File | 2.16 KB | 0644 |
|
throttle.js | File | 3.19 KB | 0644 |
|
throttle.js.map | File | 2.41 KB | 0644 |
|
throttleTime.js | File | 3.15 KB | 0644 |
|
throttleTime.js.map | File | 2.44 KB | 0644 |
|
throwIfEmpty.js | File | 1.8 KB | 0644 |
|
throwIfEmpty.js.map | File | 1.26 KB | 0644 |
|
timeInterval.js | File | 1.11 KB | 0644 |
|
timeInterval.js.map | File | 977 B | 0644 |
|
timeout.js | File | 529 B | 0644 |
|
timeout.js.map | File | 445 B | 0644 |
|
timeoutWith.js | File | 2.82 KB | 0644 |
|
timeoutWith.js.map | File | 2.12 KB | 0644 |
|
timestamp.js | File | 574 B | 0644 |
|
timestamp.js.map | File | 509 B | 0644 |
|
toArray.js | File | 325 B | 0644 |
|
toArray.js.map | File | 415 B | 0644 |
|
window.js | File | 2.42 KB | 0644 |
|
window.js.map | File | 1.84 KB | 0644 |
|
windowCount.js | File | 2.96 KB | 0644 |
|
windowCount.js.map | File | 2.55 KB | 0644 |
|
windowTime.js | File | 6.41 KB | 0644 |
|
windowTime.js.map | File | 5.09 KB | 0644 |
|
windowToggle.js | File | 4.96 KB | 0644 |
|
windowToggle.js.map | File | 3.88 KB | 0644 |
|
windowWhen.js | File | 3.04 KB | 0644 |
|
windowWhen.js.map | File | 2.29 KB | 0644 |
|
withLatestFrom.js | File | 2.95 KB | 0644 |
|
withLatestFrom.js.map | File | 2.44 KB | 0644 |
|
zip.js | File | 441 B | 0644 |
|
zip.js.map | File | 381 B | 0644 |
|
zipAll.js | File | 259 B | 0644 |
|
zipAll.js.map | File | 297 B | 0644 |
|