mirror of
https://github.com/fooflington/selfdefined.git
synced 2025-06-13 22:15:25 +00:00
update
This commit is contained in:
41
node_modules/rxjs/operator/sample.js
generated
vendored
Normal file
41
node_modules/rxjs/operator/sample.js
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
"use strict";
|
||||
var sample_1 = require('../operators/sample');
|
||||
/**
|
||||
* Emits the most recently emitted value from the source Observable whenever
|
||||
* another Observable, the `notifier`, emits.
|
||||
*
|
||||
* <span class="informal">It's like {@link sampleTime}, but samples whenever
|
||||
* the `notifier` Observable emits something.</span>
|
||||
*
|
||||
* <img src="./img/sample.png" width="100%">
|
||||
*
|
||||
* Whenever the `notifier` Observable emits a value or completes, `sample`
|
||||
* looks at the source Observable and emits whichever value it has most recently
|
||||
* emitted since the previous sampling, unless the source has not emitted
|
||||
* anything since the previous sampling. The `notifier` is subscribed to as soon
|
||||
* as the output Observable is subscribed.
|
||||
*
|
||||
* @example <caption>On every click, sample the most recent "seconds" timer</caption>
|
||||
* var seconds = Rx.Observable.interval(1000);
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* var result = seconds.sample(clicks);
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link audit}
|
||||
* @see {@link debounce}
|
||||
* @see {@link sampleTime}
|
||||
* @see {@link throttle}
|
||||
*
|
||||
* @param {Observable<any>} notifier The Observable to use for sampling the
|
||||
* source Observable.
|
||||
* @return {Observable<T>} An Observable that emits the results of sampling the
|
||||
* values emitted by the source Observable whenever the notifier Observable
|
||||
* emits value or completes.
|
||||
* @method sample
|
||||
* @owner Observable
|
||||
*/
|
||||
function sample(notifier) {
|
||||
return sample_1.sample(notifier)(this);
|
||||
}
|
||||
exports.sample = sample;
|
||||
//# sourceMappingURL=sample.js.map
|
Reference in New Issue
Block a user