3304c397cfeb7df2b1f96aba399f0796d135920a2021cb5e679545afc549f875.json 9.9 KB

1
  1. {"ast":null,"code":"import { OuterSubscriber } from '../OuterSubscriber';\nimport { subscribeToResult } from '../util/subscribeToResult';\nexport function expand(project, concurrent = Number.POSITIVE_INFINITY, scheduler = undefined) {\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 OuterSubscriber {\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(subscribeToResult(this, result, value, index));\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(outerValue, innerValue, outerIndex, innerIndex, innerSub) {\n this._next(innerValue);\n }\n notifyComplete(innerSub) {\n const buffer = this.buffer;\n const destination = this.destination;\n destination.remove(innerSub);\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":["OuterSubscriber","subscribeToResult","expand","project","concurrent","Number","POSITIVE_INFINITY","scheduler","undefined","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","outerValue","innerValue","outerIndex","innerIndex","innerSub","notifyComplete","remove","length","shift"],"sources":["C:/FatboarProject/angular-client/node_modules/rxjs/_esm2015/internal/operators/expand.js"],"sourcesContent":["import { OuterSubscriber } from '../OuterSubscriber';\nimport { subscribeToResult } from '../util/subscribeToResult';\nexport function expand(project, concurrent = Number.POSITIVE_INFINITY, scheduler = undefined) {\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 OuterSubscriber {\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 { subscriber, result, value, index } = 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 { project } = this;\n const result = project(value, index);\n if (!this.scheduler) {\n this.subscribeToProjection(result, value, index);\n }\n else {\n const state = { subscriber: this, result, value, index };\n const destination = this.destination;\n destination.add(this.scheduler.schedule(ExpandSubscriber.dispatch, 0, state));\n }\n }\n catch (e) {\n destination.error(e);\n }\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(subscribeToResult(this, result, value, index));\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(outerValue, innerValue, outerIndex, innerIndex, innerSub) {\n this._next(innerValue);\n }\n notifyComplete(innerSub) {\n const buffer = this.buffer;\n const destination = this.destination;\n destination.remove(innerSub);\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}\n"],"mappings":"AAAA,SAASA,eAAe,QAAQ,oBAAoB;AACpD,SAASC,iBAAiB,QAAQ,2BAA2B;AAC7D,OAAO,SAASC,MAAMA,CAACC,OAAO,EAAEC,UAAU,GAAGC,MAAM,CAACC,iBAAiB,EAAEC,SAAS,GAAGC,SAAS,EAAE;EAC1FJ,UAAU,GAAG,CAACA,UAAU,IAAI,CAAC,IAAI,CAAC,GAAGC,MAAM,CAACC,iBAAiB,GAAGF,UAAU;EAC1E,OAAQK,MAAM,IAAKA,MAAM,CAACC,IAAI,CAAC,IAAIC,cAAc,CAACR,OAAO,EAAEC,UAAU,EAAEG,SAAS,CAAC,CAAC;AACtF;AACA,OAAO,MAAMI,cAAc,CAAC;EACxBC,WAAWA,CAACT,OAAO,EAAEC,UAAU,EAAEG,SAAS,EAAE;IACxC,IAAI,CAACJ,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACC,UAAU,GAAGA,UAAU;IAC5B,IAAI,CAACG,SAAS,GAAGA,SAAS;EAC9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