Kargi-Sitesi/.angular/cache/18.2.11/babel-webpack/0632564f8d2c34097f1b7626068b0e7fc5c5483ea19f5db00254a40e1cab12a0.json

1 line
16 KiB
JSON
Raw Normal View History

2024-10-31 19:07:58 +00:00
{"ast":null,"code":"import { Subject } from '../Subject';\nimport { async } from '../scheduler/async';\nimport { Subscriber } from '../Subscriber';\nimport { isNumeric } from '../util/isNumeric';\nimport { isScheduler } from '../util/isScheduler';\nexport function windowTime(windowTimeSpan) {\n let scheduler = async;\n let windowCreationInterval = null;\n let maxWindowSize = Number.POSITIVE_INFINITY;\n if (isScheduler(arguments[3])) {\n scheduler = arguments[3];\n }\n if (isScheduler(arguments[2])) {\n scheduler = arguments[2];\n } else if (isNumeric(arguments[2])) {\n maxWindowSize = Number(arguments[2]);\n }\n if (isScheduler(arguments[1])) {\n scheduler = arguments[1];\n } else if (isNumeric(arguments[1])) {\n windowCreationInterval = Number(arguments[1]);\n }\n return function windowTimeOperatorFunction(source) {\n return source.lift(new WindowTimeOperator(windowTimeSpan, windowCreationInterval, maxWindowSize, scheduler));\n };\n}\nclass WindowTimeOperator {\n constructor(windowTimeSpan, windowCreationInterval, maxWindowSize, scheduler) {\n this.windowTimeSpan = windowTimeSpan;\n this.windowCreationInterval = windowCreationInterval;\n this.maxWindowSize = maxWindowSize;\n this.scheduler = scheduler;\n }\n call(subscriber, source) {\n return source.subscribe(new WindowTimeSubscriber(subscriber, this.windowTimeSpan, this.windowCreationInterval, this.maxWindowSize, this.scheduler));\n }\n}\nclass CountedSubject extends Subject {\n constructor() {\n super(...arguments);\n this._numberOfNextedValues = 0;\n }\n next(value) {\n this._numberOfNextedValues++;\n super.next(value);\n }\n get numberOfNextedValues() {\n return this._numberOfNextedValues;\n }\n}\nclass WindowTimeSubscriber extends Subscriber {\n constructor(destination, windowTimeSpan, windowCreationInterval, maxWindowSize, scheduler) {\n super(destination);\n this.destination = destination;\n this.windowTimeSpan = windowTimeSpan;\n this.windowCreationInterval = windowCreationInterval;\n this.maxWindowSize = maxWindowSize;\n this.scheduler = scheduler;\n this.windows = [];\n const window = this.openWindow();\n if (windowCreationInterval !== null && windowCreationInterval >= 0) {\n const closeState = {\n subscriber: this,\n window,\n context: null\n };\n const creationState = {\n windowTimeSpan,\n windowCreationInterval,\n subscriber: this,\n scheduler\n };\n this.add(scheduler.schedule(dispatchWindowClose, windowTimeSpan, closeState));\n this.add(scheduler.schedule(dispatchWindowCreation, windowCreationInterval, creationState));\n } else {\n const timeSpanOnlyState = {\n subscriber: this,\n window,\n windowTimeSpan\n };\n this.add(scheduler.schedule(dispatchWindowTimeSpanOnly, windowTimeSpan, timeSpanOnlyState));\n }\n }\n _next(value) {\n const windows = this.windows;\n const len = windows.length;\n for (let i = 0; i < len; i++) {\n const window = windows[i];\n if (!window.closed) {\n window.next(value);\n if (window.numberOfNextedValues >= this.maxWindowSize) {\n this.closeWindow(window);\n }\n }\n }\n }\n _error(err) {\n const windows = this.windows;\n while (windows.length > 0) {\n windows.shift().error(err);\n }\n this.destination.error(err);\n }\n _complete() {\n const windows = this.windows;\n while (windows.length > 0) {\n const window = windows.shift();\n if (!window.closed) {\n window.complete();\n }\n }\n this.destination.complete();\n }\n openWindow() {\n const window = new CountedSubject();\n this.windows.push(window);\n const destination = this.destination;\n destination.next(window);\n return window;\n }\n closeWindow(window) {\n window.complete();\n const windows = this.windows;\n windows.splice(windows.indexOf(window), 1);\n }\n}\nfunction dispatchWindowTimeSpanOnly(state) {\n const {\n