Kargi-Sitesi/.angular/cache/16.2.16/babel-webpack/5145c47dbfcb65cb3e4eeca77770e03d8f696c858eabbe7f2764d033d6e4666b.json

1 line
17 KiB
JSON
Raw Normal View History

2024-10-31 19:07:58 +00:00
{"ast":null,"code":"import { async } from '../scheduler/async';\nimport { Subscriber } from '../Subscriber';\nimport { isScheduler } from '../util/isScheduler';\nexport function bufferTime(bufferTimeSpan) {\n let length = arguments.length;\n let scheduler = async;\n if (isScheduler(arguments[arguments.length - 1])) {\n scheduler = arguments[arguments.length - 1];\n length--;\n }\n let bufferCreationInterval = null;\n if (length >= 2) {\n bufferCreationInterval = arguments[1];\n }\n let maxBufferSize = Number.POSITIVE_INFINITY;\n if (length >= 3) {\n maxBufferSize = arguments[2];\n }\n return function bufferTimeOperatorFunction(source) {\n return source.lift(new BufferTimeOperator(bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler));\n };\n}\nclass BufferTimeOperator {\n constructor(bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler) {\n this.bufferTimeSpan = bufferTimeSpan;\n this.bufferCreationInterval = bufferCreationInterval;\n this.maxBufferSize = maxBufferSize;\n this.scheduler = scheduler;\n }\n call(subscriber, source) {\n return source.subscribe(new BufferTimeSubscriber(subscriber, this.bufferTimeSpan, this.bufferCreationInterval, this.maxBufferSize, this.scheduler));\n }\n}\nclass Context {\n constructor() {\n this.buffer = [];\n }\n}\nclass BufferTimeSubscriber extends Subscriber {\n constructor(destination, bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler) {\n super(destination);\n this.bufferTimeSpan = bufferTimeSpan;\n this.bufferCreationInterval = bufferCreationInterval;\n this.maxBufferSize = maxBufferSize;\n this.scheduler = scheduler;\n this.contexts = [];\n const context = this.openContext();\n this.timespanOnly = bufferCreationInterval == null || bufferCreationInterval < 0;\n if (this.timespanOnly) {\n const timeSpanOnlyState = {\n subscriber: this,\n context,\n bufferTimeSpan\n };\n this.add(context.closeAction = scheduler.schedule(dispatchBufferTimeSpanOnly, bufferTimeSpan, timeSpanOnlyState));\n } else {\n const closeState = {\n subscriber: this,\n context\n };\n const creationState = {\n bufferTimeSpan,\n bufferCreationInterval,\n subscriber: this,\n scheduler\n };\n this.add(context.closeAction = scheduler.schedule(dispatchBufferClose, bufferTimeSpan, closeState));\n this.add(scheduler.schedule(dispatchBufferCreation, bufferCreationInterval, creationState));\n }\n }\n _next(value) {\n const contexts = this.contexts;\n const len = contexts.length;\n let filledBufferContext;\n for (let i = 0; i < len; i++) {\n const context = contexts[i];\n const buffer = context.buffer;\n buffer.push(value);\n if (buffer.length == this.maxBufferSize) {\n filledBufferContext = context;\n }\n }\n if (filledBufferContext) {\n this.onBufferFull(filledBufferContext);\n }\n }\n _error(err) {\n this.contexts.length = 0;\n super._error(err);\n }\n _complete() {\n const {\n contexts,\n destination\n } = this;\n while (contexts.length > 0) {\n const context = contexts.shift();\n destination.next(context.buffer);\n }\n super._complete();\n }\n _unsubscribe() {\n this.contexts = null;\n }\n onBufferFull(context) {\n this.closeContext(context);\n const closeAction = context.closeAction;\n closeAction.unsubscribe();\n this.remove(closeAction);\n if (!this.closed && this.timespanOnly) {\n context = this.openContext();\n const bufferTimeSpan = this.bufferTimeSpan;\n const timeSpanOnlyState = {\n subscriber: this,\n context,\n bufferTimeSpan\n };\n this.add(context.closeAction = this.scheduler.schedule(dispatchBufferTimeSpanOnly, bufferTimeSpan, timeSpanOnlyState));\n }\n }\n openContext() {\n const context = new Context();\n this.contexts.push(context);\n return context;\n }\n closeContext(context) {\n this.d