1 line
10 KiB
JSON
1 line
10 KiB
JSON
{"ast":null,"code":"import { Subscription } from '../Subscription';\nimport { subscribeToResult } from '../util/subscribeToResult';\nimport { OuterSubscriber } from '../OuterSubscriber';\nexport function bufferToggle(openings, closingSelector) {\n return function bufferToggleOperatorFunction(source) {\n return source.lift(new BufferToggleOperator(openings, closingSelector));\n };\n}\n\nclass BufferToggleOperator {\n constructor(openings, closingSelector) {\n this.openings = openings;\n this.closingSelector = closingSelector;\n }\n\n call(subscriber, source) {\n return source.subscribe(new BufferToggleSubscriber(subscriber, this.openings, this.closingSelector));\n }\n\n}\n\nclass BufferToggleSubscriber extends OuterSubscriber {\n constructor(destination, openings, closingSelector) {\n super(destination);\n this.closingSelector = closingSelector;\n this.contexts = [];\n this.add(subscribeToResult(this, openings));\n }\n\n _next(value) {\n const contexts = this.contexts;\n const len = contexts.length;\n\n for (let i = 0; i < len; i++) {\n contexts[i].buffer.push(value);\n }\n }\n\n _error(err) {\n const contexts = this.contexts;\n\n while (contexts.length > 0) {\n const context = contexts.shift();\n context.subscription.unsubscribe();\n context.buffer = null;\n context.subscription = null;\n }\n\n this.contexts = null;\n\n super._error(err);\n }\n\n _complete() {\n const contexts = this.contexts;\n\n while (contexts.length > 0) {\n const context = contexts.shift();\n this.destination.next(context.buffer);\n context.subscription.unsubscribe();\n context.buffer = null;\n context.subscription = null;\n }\n\n this.contexts = null;\n\n super._complete();\n }\n\n notifyNext(outerValue, innerValue) {\n outerValue ? this.closeBuffer(outerValue) : this.openBuffer(innerValue);\n }\n\n notifyComplete(innerSub) {\n this.closeBuffer(innerSub.context);\n }\n\n openBuffer(value) {\n try {\n const closingSelector = this.closingSelector;\n const closingNotifier = closingSelector.call(this, value);\n\n if (closingNotifier) {\n this.trySubscribe(closingNotifier);\n }\n } catch (err) {\n this._error(err);\n }\n }\n\n closeBuffer(context) {\n const contexts = this.contexts;\n\n if (contexts && context) {\n const {\n buffer,\n subscription\n } = context;\n this.destination.next(buffer);\n contexts.splice(contexts.indexOf(context), 1);\n this.remove(subscription);\n subscription.unsubscribe();\n }\n }\n\n trySubscribe(closingNotifier) {\n const contexts = this.contexts;\n const buffer = [];\n const subscription = new Subscription();\n const context = {\n buffer,\n subscription\n };\n contexts.push(context);\n const innerSubscription = subscribeToResult(this, closingNotifier, context);\n\n if (!innerSubscription || innerSubscription.closed) {\n this.closeBuffer(context);\n } else {\n innerSubscription.context = context;\n this.add(innerSubscription);\n subscription.add(innerSubscription);\n }\n }\n\n}","map":{"version":3,"names":["Subscription","subscribeToResult","OuterSubscriber","bufferToggle","openings","closingSelector","bufferToggleOperatorFunction","source","lift","BufferToggleOperator","constructor","call","subscriber","subscribe","BufferToggleSubscriber","destination","contexts","add","_next","value","len","length","i","buffer","push","_error","err","context","shift","subscription","unsubscribe","_complete","next","notifyNext","outerValue","innerValue","closeBuffer","openBuffer","notifyComplete","innerSub","closingNotifier","trySubscribe","splice","indexOf","remove","innerSubscription","closed"],"sources":["D:/MobileDev/WRB/WrenchBoard2023a/node_modules/rxjs/_esm2015/internal/operators/bufferToggle.js"],"sourcesContent":["import { Subscription } from '../Subscription';\nimport { subscribeToResult } from '../util/subscribeToResult';\nimport { OuterSubscriber } from '../OuterSubscriber';\nexport function bufferToggle(openings, closingSelector) {\n return function bufferToggleOperatorFunction(source) {\n return source.lift(new BufferToggleOperator(openings, closingSelector));\n };\n}\nclass BufferToggleOperator {\n constructor(openings, closingSelector) {\n this.openings = openings;\n this.closingSelector = closingSelector;\n }\n call(subscriber, source) {\n return source.subscribe(new BufferToggleSubscriber(subscriber, this.openings, this.closingSelector));\n }\n}\nclass BufferToggleSubscriber extends OuterSubscriber {\n constructor(destination, openings, closingSelector) {\n super(destination);\n this.closingSelector = closingSelector;\n this.contexts = [];\n this.add(subscribeToResult(this, openings));\n }\n _next(value) {\n const contexts = this.contexts;\n const len = contexts.length;\n for (let i = 0; i < len; i++) {\n contexts[i].buffer.push(value);\n }\n }\n _error(err) {\n const contexts = this.contexts;\n while (contexts.length > 0) {\n const context = contexts.shift();\n context.subscription.unsubscribe();\n context.buffer = null;\n context.subscription = null;\n }\n this.contexts = null;\n super._error(err);\n }\n _complete() {\n const contexts = this.contexts;\n while (contexts.length > 0) {\n const context = contexts.shift();\n this.destination.next(context.buffer);\n context.subscription.unsubscribe();\n context.buffer = null;\n context.subscription = null;\n }\n this.contexts = null;\n super._complete();\n }\n notifyNext(outerValue, innerValue) {\n outerValue ? this.closeBuffer(outerValue) : this.openBuffer(innerValue);\n }\n notifyComplete(innerSub) {\n this.closeBuffer(innerSub.context);\n }\n openBuffer(value) {\n try {\n const closingSelector = this.closingSelector;\n const closingNotifier = closingSelector.call(this, value);\n if (closingNotifier) {\n this.trySubscribe(closingNotifier);\n }\n }\n catch (err) {\n this._error(err);\n }\n }\n closeBuffer(context) {\n const contexts = this.contexts;\n if (contexts && context) {\n const { buffer, subscription } = context;\n this.destination.next(buffer);\n contexts.splice(contexts.indexOf(context), 1);\n this.remove(subscription);\n subscription.unsubscribe();\n }\n }\n trySubscribe(closingNotifier) {\n const contexts = this.contexts;\n const buffer = [];\n const subscription = new Subscription();\n const context = { buffer, subscription };\n contexts.push(context);\n const innerSubscription = subscribeToResult(this, closingNotifier, context);\n if (!innerSubscription || innerSubscription.closed) {\n this.closeBuffer(context);\n }\n else {\n innerSubscription.context = context;\n this.add(innerSubscription);\n subscription.add(innerSubscription);\n }\n }\n}\n"],"mappings":"AAAA,SAASA,YAAT,QAA6B,iBAA7B;AACA,SAASC,iBAAT,QAAkC,2BAAlC;AACA,SAASC,eAAT,QAAgC,oBAAhC;AACA,OAAO,SAASC,YAAT,CAAsBC,QAAtB,EAAgCC,eAAhC,EAAiD;EACpD,OAAO,SAASC,4BAAT,CAAsCC,MAAtC,EAA8C;IACjD,OAAOA,MAAM,CAACC,IAAP,CAAY,IAAIC,oBAAJ,CAAyBL,QAAzB,EAAmCC,eAAnC,CAAZ,CAAP;EACH,CAFD;AAGH;;AACD,MAAMI,oBAAN,CAA2B;EACvBC,WAA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