Tumortisch-Dist/resources/app/node_modules/rxjs/operators/throttleTime.js.map
2021-06-15 16:00:08 +02:00

1 line
6.7 KiB
Plaintext

{"version":3,"file":"throttleTime.js","sourceRoot":"","sources":["../../src/operators/throttleTime.ts"],"names":[],"mappings":";;;;;;AACA,2BAA2B,eAAe,CAAC,CAAA;AAG3C,sBAAsB,oBAAoB,CAAC,CAAA;AAE3C,yBAAsD,YAAY,CAAC,CAAA;AAGnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,sBAAgC,QAAgB,EAChB,SAA6B,EAC7B,MAA8C;IAD9C,yBAA6B,GAA7B,yBAA6B;IAC7B,sBAA8C,GAA9C,yCAA8C;IAC5E,MAAM,CAAC,UAAC,MAAqB,IAAK,OAAA,MAAM,CAAC,IAAI,CAAC,IAAI,oBAAoB,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,EAA3F,CAA2F,CAAC;AAChI,CAAC;AAJe,oBAAY,eAI3B,CAAA;AAED;IACE,8BAAoB,QAAgB,EAChB,SAAqB,EACrB,OAAgB,EAChB,QAAiB;QAHjB,aAAQ,GAAR,QAAQ,CAAQ;QAChB,cAAS,GAAT,SAAS,CAAY;QACrB,YAAO,GAAP,OAAO,CAAS;QAChB,aAAQ,GAAR,QAAQ,CAAS;IACrC,CAAC;IAED,mCAAI,GAAJ,UAAK,UAAyB,EAAE,MAAW;QACzC,MAAM,CAAC,MAAM,CAAC,SAAS,CACrB,IAAI,sBAAsB,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,CACnG,CAAC;IACJ,CAAC;IACH,2BAAC;AAAD,CAAC,AAZD,IAYC;AAED;;;;GAIG;AACH;IAAwC,0CAAa;IAKnD,gCAAY,WAA0B,EAClB,QAAgB,EAChB,SAAqB,E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GAAG,KAAK,CAAC;YACjC,CAAC;YACD,SAAS,CAAC,WAAW,EAAE,CAAC;YACxB,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YACvB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACxB,CAAC;IACH,CAAC;IACH,6BAAC;AAAD,CAAC,AAxCD,CAAwC,uBAAU,GAwCjD;AAMD,sBAAyB,GAAmB;IAClC,+BAAU,CAAS;IAC3B,UAAU,CAAC,aAAa,EAAE,CAAC;AAC7B,CAAC","sourcesContent":["import { Operator } from '../Operator';\nimport { Subscriber } from '../Subscriber';\nimport { IScheduler } from '../Scheduler';\nimport { Subscription, TeardownLogic } from '../Subscription';\nimport { async } from '../scheduler/async';\nimport { Observable } from '../Observable';\nimport { ThrottleConfig, defaultThrottleConfig } from './throttle';\nimport { MonoTypeOperatorFunction } from '../interfaces';\n\n/**\n * Emits a value from the source Observable, then ignores subsequent source\n * values for `duration` milliseconds, then repeats this process.\n *\n * <span class=\"informal\">Lets a value pass, then ignores source values for the\n * next `duration` milliseconds.</span>\n *\n * <img src=\"./img/throttleTime.png\" width=\"100%\">\n *\n * `throttleTime` emits the source Observable values on the output Observable\n * when its internal timer is disabled, and ignores source values when the timer\n * is enabled. Initially, the timer is disabled. As soon as the first source\n * value arrives, it is forwarded to the output Observable, and then the timer\n * is enabled. After `duration` milliseconds (or the time unit determined\n * internally by the optional `scheduler`) has passed, the timer is disabled,\n * and this process repeats for the next source value. Optionally takes a\n * {@link IScheduler} for managing timers.\n *\n * @example <caption>Emit clicks at a rate of at most one click per second</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var result = clicks.throttleTime(1000);\n * result.subscribe(x => console.log(x));\n *\n * @see {@link auditTime}\n * @see {@link debounceTime}\n * @see {@link delay}\n * @see {@link sampleTime}\n * @see {@link throttle}\n *\n * @param {number} duration Time to wait before emitting another value after\n * emitting the last value, measured in milliseconds or the time unit determined\n * internally by the optional `scheduler`.\n * @param {Scheduler} [scheduler=async] The {@link IScheduler} to use for\n * managing the timers that handle the throttling.\n * @return {Observable<T>} An Observable that performs the throttle operation to\n * limit the rate of emissions from the source.\n * @method throttleTime\n * @owner Observable\n */\nexport function throttleTime<T>(duration: number,\n scheduler: IScheduler = async,\n config: ThrottleConfig = defaultThrottleConfig): MonoTypeOperatorFunction<T> {\n return (source: Observable<T>) => source.lift(new ThrottleTimeOperator(duration, scheduler, config.leading, config.trailing));\n}\n\nclass ThrottleTimeOperator<T> implements Operator<T, T> {\n constructor(private duration: number,\n private scheduler: IScheduler,\n private leading: boolean,\n private trailing: boolean) {\n }\n\n call(subscriber: Subscriber<T>, source: any): TeardownLogic {\n return source.subscribe(\n new ThrottleTimeSubscriber(subscriber, this.duration, this.scheduler, this.leading, this.trailing)\n );\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nclass ThrottleTimeSubscriber<T> extends Subscriber<T> {\n private throttled: Subscription;\n private _hasTrailingValue: boolean = false;\n private _trailingValue: T = null;\n\n constructor(destination: Subscriber<T>,\n private duration: number,\n private scheduler: IScheduler,\n private leading: boolean,\n private trailing: boolean) {\n super(destination);\n }\n\n protected _next(value: T) {\n if (this.throttled) {\n if (this.trailing) {\n this._trailingValue = value;\n this._hasTrailingValue = true;\n }\n } else {\n this.add(this.throttled = this.scheduler.schedule(dispatchNext, this.duration, { subscriber: this }));\n if (this.leading) {\n this.destination.next(value);\n }\n }\n }\n\n clearThrottle() {\n const throttled = this.throttled;\n if (throttled) {\n if (this.trailing && this._hasTrailingValue) {\n this.destination.next(this._trailingValue);\n this._trailingValue = null;\n this._hasTrailingValue = false;\n }\n throttled.unsubscribe();\n this.remove(throttled);\n this.throttled = null;\n }\n }\n}\n\ninterface DispatchArg<T> {\n subscriber: ThrottleTimeSubscriber<T>;\n}\n\nfunction dispatchNext<T>(arg: DispatchArg<T>) {\n const { subscriber } = arg;\n subscriber.clearThrottle();\n}\n"]}