Kargi-Sitesi/.angular/cache/16.2.16/babel-webpack/46a772a0b432e9cd4d93b3148588ca309edb8bc749433d46e1be06f0b7daec2d.json

1 line
10 KiB
JSON
Raw Normal View History

2024-10-31 19:07:58 +00:00
{"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}\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 } catch (err) {\n this._error(err);\n }\n }\n closeBuffer(context) {\n const contexts = this.contexts;\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 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 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}","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":["/home/arctichawk1/Desktop/Projects/Public/Kargi-Sitesi/node_modules/rxjs/_esm2015/internal/operators/bufferToggle.js"],"sourcesContent":["import { Subscription } from '../Subscription';\nimport { subscribeToResult } from '../util/subscribeToResult';\nimport { OuterSubscriber } from '..