You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
2.7 KiB
1 lines
2.7 KiB
{"version":3,"file":"throttle.js","sourceRoot":"","sources":["../../src/operator/throttle.ts"],"names":[],"mappings":";AACA,yBAA+E,uBAAuB,CAAC,CAAA;AAEvG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,kBAC4B,gBAA6D,EAC7D,MAA8C;IAA9C,sBAA8C,GAA9C,yCAA8C;IACxE,MAAM,CAAC,mBAAW,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC;AACrD,CAAC;AAJe,gBAAQ,WAIvB,CAAA","sourcesContent":["import { Observable, SubscribableOrPromise } from '../Observable';\nimport { throttle as higherOrder, ThrottleConfig, defaultThrottleConfig } from '../operators/throttle';\n\n/**\n * Emits a value from the source Observable, then ignores subsequent source\n * values for a duration determined by another Observable, then repeats this\n * process.\n *\n * <span class=\"informal\">It's like {@link throttleTime}, but the silencing\n * duration is determined by a second Observable.</span>\n *\n * <img src=\"./img/throttle.png\" width=\"100%\">\n *\n * `throttle` 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 by calling the `durationSelector` function with the source value,\n * which returns the \"duration\" Observable. When the duration Observable emits a\n * value or completes, the timer is disabled, and this process repeats for the\n * next source value.\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.throttle(ev => Rx.Observable.interval(1000));\n * result.subscribe(x => console.log(x));\n *\n * @see {@link audit}\n * @see {@link debounce}\n * @see {@link delayWhen}\n * @see {@link sample}\n * @see {@link throttleTime}\n *\n * @param {function(value: T): SubscribableOrPromise} durationSelector A function\n * that receives a value from the source Observable, for computing the silencing\n * duration for each source value, returned as an Observable or a Promise.\n * @param {Object} config a configuration object to define `leading` and `trailing` behavior. Defaults\n * to `{ leading: true, trailing: false }`.\n * @return {Observable<T>} An Observable that performs the throttle operation to\n * limit the rate of emissions from the source.\n * @method throttle\n * @owner Observable\n */\nexport function throttle<T>(this: Observable<T>,\n durationSelector: (value: T) => SubscribableOrPromise<number>,\n config: ThrottleConfig = defaultThrottleConfig): Observable<T> {\n return higherOrder(durationSelector, config)(this);\n}\n"]} |