1 line
7.3 KiB
JSON
1 line
7.3 KiB
JSON
{"ast":null,"code":"import { Subscriber } from '../Subscriber';\nimport { Subject } from '../Subject';\nexport function windowCount(windowSize, startWindowEvery = 0) {\n return function windowCountOperatorFunction(source) {\n return source.lift(new WindowCountOperator(windowSize, startWindowEvery));\n };\n}\n\nclass WindowCountOperator {\n constructor(windowSize, startWindowEvery) {\n this.windowSize = windowSize;\n this.startWindowEvery = startWindowEvery;\n }\n\n call(subscriber, source) {\n return source.subscribe(new WindowCountSubscriber(subscriber, this.windowSize, this.startWindowEvery));\n }\n\n}\n\nclass WindowCountSubscriber extends Subscriber {\n constructor(destination, windowSize, startWindowEvery) {\n super(destination);\n this.destination = destination;\n this.windowSize = windowSize;\n this.startWindowEvery = startWindowEvery;\n this.windows = [new Subject()];\n this.count = 0;\n destination.next(this.windows[0]);\n }\n\n _next(value) {\n const startWindowEvery = this.startWindowEvery > 0 ? this.startWindowEvery : this.windowSize;\n const destination = this.destination;\n const windowSize = this.windowSize;\n const windows = this.windows;\n const len = windows.length;\n\n for (let i = 0; i < len && !this.closed; i++) {\n windows[i].next(value);\n }\n\n const c = this.count - windowSize + 1;\n\n if (c >= 0 && c % startWindowEvery === 0 && !this.closed) {\n windows.shift().complete();\n }\n\n if (++this.count % startWindowEvery === 0 && !this.closed) {\n const window = new Subject();\n windows.push(window);\n destination.next(window);\n }\n }\n\n _error(err) {\n const windows = this.windows;\n\n if (windows) {\n while (windows.length > 0 && !this.closed) {\n windows.shift().error(err);\n }\n }\n\n this.destination.error(err);\n }\n\n _complete() {\n const windows = this.windows;\n\n if (windows) {\n while (windows.length > 0 && !this.closed) {\n windows.shift().complete();\n }\n }\n\n this.destination.complete();\n }\n\n _unsubscribe() {\n this.count = 0;\n this.windows = null;\n }\n\n}","map":{"version":3,"names":["Subscriber","Subject","windowCount","windowSize","startWindowEvery","windowCountOperatorFunction","source","lift","WindowCountOperator","constructor","call","subscriber","subscribe","WindowCountSubscriber","destination","windows","count","next","_next","value","len","length","i","closed","c","shift","complete","window","push","_error","err","error","_complete","_unsubscribe"],"sources":["D:/MobileDev/WRB/WrenchBoard2023a/node_modules/rxjs/_esm2015/internal/operators/windowCount.js"],"sourcesContent":["import { Subscriber } from '../Subscriber';\nimport { Subject } from '../Subject';\nexport function windowCount(windowSize, startWindowEvery = 0) {\n return function windowCountOperatorFunction(source) {\n return source.lift(new WindowCountOperator(windowSize, startWindowEvery));\n };\n}\nclass WindowCountOperator {\n constructor(windowSize, startWindowEvery) {\n this.windowSize = windowSize;\n this.startWindowEvery = startWindowEvery;\n }\n call(subscriber, source) {\n return source.subscribe(new WindowCountSubscriber(subscriber, this.windowSize, this.startWindowEvery));\n }\n}\nclass WindowCountSubscriber extends Subscriber {\n constructor(destination, windowSize, startWindowEvery) {\n super(destination);\n this.destination = destination;\n this.windowSize = windowSize;\n this.startWindowEvery = startWindowEvery;\n this.windows = [new Subject()];\n this.count = 0;\n destination.next(this.windows[0]);\n }\n _next(value) {\n const startWindowEvery = (this.startWindowEvery > 0) ? this.startWindowEvery : this.windowSize;\n const destination = this.destination;\n const windowSize = this.windowSize;\n const windows = this.windows;\n const len = windows.length;\n for (let i = 0; i < len && !this.closed; i++) {\n windows[i].next(value);\n }\n const c = this.count - windowSize + 1;\n if (c >= 0 && c % startWindowEvery === 0 && !this.closed) {\n windows.shift().complete();\n }\n if (++this.count % startWindowEvery === 0 && !this.closed) {\n const window = new Subject();\n windows.push(window);\n destination.next(window);\n }\n }\n _error(err) {\n const windows = this.windows;\n if (windows) {\n while (windows.length > 0 && !this.closed) {\n windows.shift().error(err);\n }\n }\n this.destination.error(err);\n }\n _complete() {\n const windows = this.windows;\n if (windows) {\n while (windows.length > 0 && !this.closed) {\n windows.shift().complete();\n }\n }\n this.destination.complete();\n }\n _unsubscribe() {\n this.count = 0;\n this.windows = null;\n }\n}\n"],"mappings":"AAAA,SAASA,UAAT,QAA2B,eAA3B;AACA,SAASC,OAAT,QAAwB,YAAxB;AACA,OAAO,SAASC,WAA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