Kargi-Sitesi/.angular/cache/16.2.16/babel-webpack/43e2847f70d42d0b6eb09aa1ed24686c8c44b6361475de3ac2eed1c9c036f9d2.json

1 line
12 KiB
JSON
Raw Normal View History

2024-10-31 19:07:58 +00:00
{"ast":null,"code":"import { Subscriber } from '../Subscriber';\nimport { Observable } from '../Observable';\nimport { OuterSubscriber } from '../OuterSubscriber';\nimport { subscribeToResult } from '../util/subscribeToResult';\nexport function delayWhen(delayDurationSelector, subscriptionDelay) {\n if (subscriptionDelay) {\n return source => new SubscriptionDelayObservable(source, subscriptionDelay).lift(new DelayWhenOperator(delayDurationSelector));\n }\n return source => source.lift(new DelayWhenOperator(delayDurationSelector));\n}\nclass DelayWhenOperator {\n constructor(delayDurationSelector) {\n this.delayDurationSelector = delayDurationSelector;\n }\n call(subscriber, source) {\n return source.subscribe(new DelayWhenSubscriber(subscriber, this.delayDurationSelector));\n }\n}\nclass DelayWhenSubscriber extends OuterSubscriber {\n constructor(destination, delayDurationSelector) {\n super(destination);\n this.delayDurationSelector = delayDurationSelector;\n this.completed = false;\n this.delayNotifierSubscriptions = [];\n this.index = 0;\n }\n notifyNext(outerValue, _innerValue, _outerIndex, _innerIndex, innerSub) {\n this.destination.next(outerValue);\n this.removeSubscription(innerSub);\n this.tryComplete();\n }\n notifyError(error, innerSub) {\n this._error(error);\n }\n notifyComplete(innerSub) {\n const value = this.removeSubscription(innerSub);\n if (value) {\n this.destination.next(value);\n }\n this.tryComplete();\n }\n _next(value) {\n const index = this.index++;\n try {\n const delayNotifier = this.delayDurationSelector(value, index);\n if (delayNotifier) {\n this.tryDelay(delayNotifier, value);\n }\n } catch (err) {\n this.destination.error(err);\n }\n }\n _complete() {\n this.completed = true;\n this.tryComplete();\n this.unsubscribe();\n }\n removeSubscription(subscription) {\n subscription.unsubscribe();\n const subscriptionIdx = this.delayNotifierSubscriptions.indexOf(subscription);\n if (subscriptionIdx !== -1) {\n this.delayNotifierSubscriptions.splice(subscriptionIdx, 1);\n }\n return subscription.outerValue;\n }\n tryDelay(delayNotifier, value) {\n const notifierSubscription = subscribeToResult(this, delayNotifier, value);\n if (notifierSubscription && !notifierSubscription.closed) {\n const destination = this.destination;\n destination.add(notifierSubscription);\n this.delayNotifierSubscriptions.push(notifierSubscription);\n }\n }\n tryComplete() {\n if (this.completed && this.delayNotifierSubscriptions.length === 0) {\n this.destination.complete();\n }\n }\n}\nclass SubscriptionDelayObservable extends Observable {\n constructor(source, subscriptionDelay) {\n super();\n this.source = source;\n this.subscriptionDelay = subscriptionDelay;\n }\n _subscribe(subscriber) {\n this.subscriptionDelay.subscribe(new SubscriptionDelaySubscriber(subscriber, this.source));\n }\n}\nclass SubscriptionDelaySubscriber extends Subscriber {\n constructor(parent, source) {\n super();\n this.parent = parent;\n this.source = source;\n this.sourceSubscribed = false;\n }\n _next(unused) {\n this.subscribeToSource();\n }\n _error(err) {\n this.unsubscribe();\n this.parent.error(err);\n }\n _complete() {\n this.unsubscribe();\n this.subscribeToSource();\n }\n subscribeToSource() {\n if (!this.sourceSubscribed) {\n this.sourceSubscribed = true;\n this.unsubscribe();\n this.source.subscribe(this.parent);\n }\n }\n}","map":{"version":3,"names":["Subscriber","Observable","OuterSubscriber","subscribeToResult","delayWhen","delayDurationSelector","subscriptionDelay","source","SubscriptionDelayObservable","lift","DelayWhenOperator","constructor","call","subscriber","subscribe","DelayWhenSubscriber","destination","completed","delayNotifierSubscriptions","index","notifyNext","outerValue","_innerValue","_outerIndex","_innerIndex","innerSub","next","removeSubscription","tryComplete","