Kargi-Sitesi/.angular/cache/18.2.11/babel-webpack/21815601a66303769779d8d8393d3a319dbdae9d0865816bd6bc725945ff316e.json

1 line
7.6 KiB
JSON
Raw Normal View History

2024-11-04 02:30:09 +00:00
{"ast":null,"code":"import { SimpleOuterSubscriber, innerSubscribe, SimpleInnerSubscriber } from '../innerSubscribe';\nexport const defaultThrottleConfig = {\n leading: true,\n trailing: false\n};\nexport function throttle(durationSelector, config = defaultThrottleConfig) {\n return source => source.lift(new ThrottleOperator(durationSelector, !!config.leading, !!config.trailing));\n}\nclass ThrottleOperator {\n constructor(durationSelector, leading, trailing) {\n this.durationSelector = durationSelector;\n this.leading = leading;\n this.trailing = trailing;\n }\n call(subscriber, source) {\n return source.subscribe(new ThrottleSubscriber(subscriber, this.durationSelector, this.leading, this.trailing));\n }\n}\nclass ThrottleSubscriber extends SimpleOuterSubscriber {\n constructor(destination, durationSelector, _leading, _trailing) {\n super(destination);\n this.destination = destination;\n this.durationSelector = durationSelector;\n this._leading = _leading;\n this._trailing = _trailing;\n this._hasValue = false;\n }\n _next(value) {\n this._hasValue = true;\n this._sendValue = value;\n if (!this._throttled) {\n if (this._leading) {\n this.send();\n } else {\n this.throttle(value);\n }\n }\n }\n send() {\n const {\n _hasValue,\n _sendValue\n } = this;\n if (_hasValue) {\n this.destination.next(_sendValue);\n this.throttle(_sendValue);\n }\n this._hasValue = false;\n this._sendValue = undefined;\n }\n throttle(value) {\n const duration = this.tryDurationSelector(value);\n if (!!duration) {\n this.add(this._throttled = innerSubscribe(duration, new SimpleInnerSubscriber(this)));\n }\n }\n tryDurationSelector(value) {\n try {\n return this.durationSelector(value);\n } catch (err) {\n this.destination.error(err);\n return null;\n }\n }\n throttlingDone() {\n const {\n _throttled,\n _trailing\n } = this;\n if (_throttled) {\n _throttled.unsubscribe();\n }\n this._throttled = undefined;\n if (_trailing) {\n this.send();\n }\n }\n notifyNext() {\n this.throttlingDone();\n }\n notifyComplete() {\n this.throttlingDone();\n }\n}","map":{"version":3,"names":["SimpleOuterSubscriber","innerSubscribe","SimpleInnerSubscriber","defaultThrottleConfig","leading","trailing","throttle","durationSelector","config","source","lift","ThrottleOperator","constructor","call","subscriber","subscribe","ThrottleSubscriber","destination","_leading","_trailing","_hasValue","_next","value","_sendValue","_throttled","send","next","undefined","duration","tryDurationSelector","add","err","error","throttlingDone","unsubscribe","notifyNext","notifyComplete"],"sources":["/home/arctichawk1/Desktop/Projects/Public/Kargi-Sitesi/node_modules/rxjs/_esm2015/internal/operators/throttle.js"],"sourcesContent":["import { SimpleOuterSubscriber, innerSubscribe, SimpleInnerSubscriber } from '../innerSubscribe';\nexport const defaultThrottleConfig = {\n leading: true,\n trailing: false\n};\nexport function throttle(durationSelector, config = defaultThrottleConfig) {\n return (source) => source.lift(new ThrottleOperator(durationSelector, !!config.leading, !!config.trailing));\n}\nclass ThrottleOperator {\n constructor(durationSelector, leading, trailing) {\n this.durationSelector = durationSelector;\n this.leading = leading;\n this.trailing = trailing;\n }\n call(subscriber, source) {\n return source.subscribe(new ThrottleSubscriber(subscriber, this.durationSelector, this.leading, this.trailing));\n }\n}\nclass ThrottleSubscriber extends SimpleOuterSubscriber {\n constructor(destination, durationSelector, _leading, _trailing) {\n super(destination);\n this.destination = destination;\n this.durationSelector = durationSelector;\n this._leading = _leading;\n this._trailing = _trailing;\n this._hasValue = false;\n }\n _next(value) {\n this._hasValue = true;\n