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 line
2.3 KiB
1 line
2.3 KiB
2 years ago
|
{"version":3,"file":"sampleTime.js","sourceRoot":"","sources":["../../src/operator/sampleTime.ts"],"names":[],"mappings":";AAEA,sBAAsB,oBAAoB,CAAC,CAAA;AAC3C,2BAA0C,yBAAyB,CAAC,CAAA;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,oBAAmD,MAAc,EAAE,SAA6B;IAA7B,yBAA6B,GAA7B,yBAA6B;IAC9F,MAAM,CAAC,uBAAW,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,IAAI,CAAkB,CAAC;AAC/D,CAAC;AAFe,kBAAU,aAEzB,CAAA","sourcesContent":["import { Observable } from '../Observable';\nimport { IScheduler } from '../Scheduler';\nimport { async } from '../scheduler/async';\nimport { sampleTime as higherOrder } from '../operators/sampleTime';\n\n/**\n * Emits the most recently emitted value from the source Observable within\n * periodic time intervals.\n *\n * <span class=\"informal\">Samples the source Observable at periodic time\n * intervals, emitting what it samples.</span>\n *\n * <img src=\"./img/sampleTime.png\" width=\"100%\">\n *\n * `sampleTime` periodically looks at the source Observable and emits whichever\n * value it has most recently emitted since the previous sampling, unless the\n * source has not emitted anything since the previous sampling. The sampling\n * happens periodically in time every `period` milliseconds (or the time unit\n * defined by the optional `scheduler` argument). The sampling starts as soon as\n * the output Observable is subscribed.\n *\n * @example <caption>Every second, emit the most recent click at most once</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var result = clicks.sampleTime(1000);\n * result.subscribe(x => console.log(x));\n *\n * @see {@link auditTime}\n * @see {@link debounceTime}\n * @see {@link delay}\n * @see {@link sample}\n * @see {@link throttleTime}\n *\n * @param {number} period The sampling period expressed in milliseconds or the\n * time unit determined internally by the optional `scheduler`.\n * @param {Scheduler} [scheduler=async] The {@link IScheduler} to use for\n * managing the timers that handle the sampling.\n * @return {Observable<T>} An Observable that emits the results of sampling the\n * values emitted by the source Observable at the specified time interval.\n * @method sampleTime\n * @owner Observable\n */\nexport function sampleTime<T>(this: Observable<T>, period: number, scheduler: IScheduler = async): Observable<T> {\n return higherOrder(period, scheduler)(this) as Observable<T>;\n}\n"]}
|