1 line
9.5 KiB
JSON
1 line
9.5 KiB
JSON
|
{"ast":null,"code":"import { SimpleOuterSubscriber, innerSubscribe, SimpleInnerSubscriber } from '../innerSubscribe';\nexport function expand(project, concurrent = Number.POSITIVE_INFINITY, scheduler) {\n concurrent = (concurrent || 0) < 1 ? Number.POSITIVE_INFINITY : concurrent;\n return source => source.lift(new ExpandOperator(project, concurrent, scheduler));\n}\nexport class ExpandOperator {\n constructor(project, concurrent, scheduler) {\n this.project = project;\n this.concurrent = concurrent;\n this.scheduler = scheduler;\n }\n call(subscriber, source) {\n return source.subscribe(new ExpandSubscriber(subscriber, this.project, this.concurrent, this.scheduler));\n }\n}\nexport class ExpandSubscriber extends SimpleOuterSubscriber {\n constructor(destination, project, concurrent, scheduler) {\n super(destination);\n this.project = project;\n this.concurrent = concurrent;\n this.scheduler = scheduler;\n this.index = 0;\n this.active = 0;\n this.hasCompleted = false;\n if (concurrent < Number.POSITIVE_INFINITY) {\n this.buffer = [];\n }\n }\n static dispatch(arg) {\n const {\n subscriber,\n result,\n value,\n index\n } = arg;\n subscriber.subscribeToProjection(result, value, index);\n }\n _next(value) {\n const destination = this.destination;\n if (destination.closed) {\n this._complete();\n return;\n }\n const index = this.index++;\n if (this.active < this.concurrent) {\n destination.next(value);\n try {\n const {\n project\n } = this;\n const result = project(value, index);\n if (!this.scheduler) {\n this.subscribeToProjection(result, value, index);\n } else {\n const state = {\n subscriber: this,\n result,\n value,\n index\n };\n const destination = this.destination;\n destination.add(this.scheduler.schedule(ExpandSubscriber.dispatch, 0, state));\n }\n } catch (e) {\n destination.error(e);\n }\n } else {\n this.buffer.push(value);\n }\n }\n subscribeToProjection(result, value, index) {\n this.active++;\n const destination = this.destination;\n destination.add(innerSubscribe(result, new SimpleInnerSubscriber(this)));\n }\n _complete() {\n this.hasCompleted = true;\n if (this.hasCompleted && this.active === 0) {\n this.destination.complete();\n }\n this.unsubscribe();\n }\n notifyNext(innerValue) {\n this._next(innerValue);\n }\n notifyComplete() {\n const buffer = this.buffer;\n this.active--;\n if (buffer && buffer.length > 0) {\n this._next(buffer.shift());\n }\n if (this.hasCompleted && this.active === 0) {\n this.destination.complete();\n }\n }\n}","map":{"version":3,"names":["SimpleOuterSubscriber","innerSubscribe","SimpleInnerSubscriber","expand","project","concurrent","Number","POSITIVE_INFINITY","scheduler","source","lift","ExpandOperator","constructor","call","subscriber","subscribe","ExpandSubscriber","destination","index","active","hasCompleted","buffer","dispatch","arg","result","value","subscribeToProjection","_next","closed","_complete","next","state","add","schedule","e","error","push","complete","unsubscribe","notifyNext","innerValue","notifyComplete","length","shift"],"sources":["/home/arctichawk1/Desktop/Projects/Public/Kargi-Sitesi/node_modules/rxjs/_esm2015/internal/operators/expand.js"],"sourcesContent":["import { SimpleOuterSubscriber, innerSubscribe, SimpleInnerSubscriber } from '../innerSubscribe';\nexport function expand(project, concurrent = Number.POSITIVE_INFINITY, scheduler) {\n concurrent = (concurrent || 0) < 1 ? Number.POSITIVE_INFINITY : concurrent;\n return (source) => source.lift(new ExpandOperator(project, concurrent, scheduler));\n}\nexport class ExpandOperator {\n constructor(project, concurrent, scheduler) {\n this.project = project;\n this.concurrent = concurrent;\n this.scheduler = scheduler;\n }\n
|