digital-theory/repl/.angular/cache/16.1.3/babel-webpack/12e8354640c2e2db29e81d0f750...

1 line
7.9 KiB
JSON
Raw Normal View History

2023-07-07 11:17:10 +02:00
{"ast":null,"code":"import { Subject } from '../Subject';\nimport { asyncScheduler } from '../scheduler/async';\nimport { Subscription } from '../Subscription';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { arrRemove } from '../util/arrRemove';\nimport { popScheduler } from '../util/args';\nimport { executeSchedule } from '../util/executeSchedule';\nexport function windowTime(windowTimeSpan, ...otherArgs) {\n var _a, _b;\n const scheduler = (_a = popScheduler(otherArgs)) !== null && _a !== void 0 ? _a : asyncScheduler;\n const windowCreationInterval = (_b = otherArgs[0]) !== null && _b !== void 0 ? _b : null;\n const maxWindowSize = otherArgs[1] || Infinity;\n return operate((source, subscriber) => {\n let windowRecords = [];\n let restartOnClose = false;\n const closeWindow = record => {\n const {\n window,\n subs\n } = record;\n window.complete();\n subs.unsubscribe();\n arrRemove(windowRecords, record);\n restartOnClose && startWindow();\n };\n const startWindow = () => {\n if (windowRecords) {\n const subs = new Subscription();\n subscriber.add(subs);\n const window = new Subject();\n const record = {\n window,\n subs,\n seen: 0\n };\n windowRecords.push(record);\n subscriber.next(window.asObservable());\n executeSchedule(subs, scheduler, () => closeWindow(record), windowTimeSpan);\n }\n };\n if (windowCreationInterval !== null && windowCreationInterval >= 0) {\n executeSchedule(subscriber, scheduler, startWindow, windowCreationInterval, true);\n } else {\n restartOnClose = true;\n }\n startWindow();\n const loop = cb => windowRecords.slice().forEach(cb);\n const terminate = cb => {\n loop(({\n window\n }) => cb(window));\n cb(subscriber);\n subscriber.unsubscribe();\n };\n source.subscribe(createOperatorSubscriber(subscriber, value => {\n loop(record => {\n record.window.next(value);\n maxWindowSize <= ++record.seen && closeWindow(record);\n });\n }, () => terminate(consumer => consumer.complete()), err => terminate(consumer => consumer.error(err))));\n return () => {\n windowRecords = null;\n };\n });\n}","map":{"version":3,"names":["Subject","asyncScheduler","Subscription","operate","createOperatorSubscriber","arrRemove","popScheduler","executeSchedule","windowTime","windowTimeSpan","otherArgs","_a","_b","scheduler","windowCreationInterval","maxWindowSize","Infinity","source","subscriber","windowRecords","restartOnClose","closeWindow","record","window","subs","complete","unsubscribe","startWindow","add","seen","push","next","asObservable","loop","cb","slice","forEach","terminate","subscribe","value","consumer","err","error"],"sources":["/home/poule/encrypted/stockage-syncable/www/development/html/digital-theory/repl/node_modules/rxjs/dist/esm/internal/operators/windowTime.js"],"sourcesContent":["import { Subject } from '../Subject';\nimport { asyncScheduler } from '../scheduler/async';\nimport { Subscription } from '../Subscription';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { arrRemove } from '../util/arrRemove';\nimport { popScheduler } from '../util/args';\nimport { executeSchedule } from '../util/executeSchedule';\nexport function windowTime(windowTimeSpan, ...otherArgs) {\n var _a, _b;\n const scheduler = (_a = popScheduler(otherArgs)) !== null && _a !== void 0 ? _a : asyncScheduler;\n const windowCreationInterval = (_b = otherArgs[0]) !== null && _b !== void 0 ? _b : null;\n const maxWindowSize = otherArgs[1] || Infinity;\n return operate((source, subscriber) => {\n let windowRecords = [];\n let restartOnClose = false;\n const closeWindow = (record) => {\n const { window, subs } = record;\n window.complete();\n subs.unsubscribe();\n