source: trip-planner-front/node_modules/rxjs/internal/operators/sample.d.ts

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.6 KB
Line 
1import { Observable } from '../Observable';
2import { MonoTypeOperatorFunction } from '../types';
3/**
4 * Emits the most recently emitted value from the source Observable whenever
5 * another Observable, the `notifier`, emits.
6 *
7 * <span class="informal">It's like {@link sampleTime}, but samples whenever
8 * the `notifier` Observable emits something.</span>
9 *
10 * ![](sample.png)
11 *
12 * Whenever the `notifier` Observable emits a value or completes, `sample`
13 * looks at the source Observable and emits whichever value it has most recently
14 * emitted since the previous sampling, unless the source has not emitted
15 * anything since the previous sampling. The `notifier` is subscribed to as soon
16 * as the output Observable is subscribed.
17 *
18 * ## Example
19 * On every click, sample the most recent "seconds" timer
20 * ```ts
21 * import { fromEvent, interval } from 'rxjs';
22 * import { sample } from 'rxjs/operators';
23 *
24 * const seconds = interval(1000);
25 * const clicks = fromEvent(document, 'click');
26 * const result = seconds.pipe(sample(clicks));
27 * result.subscribe(x => console.log(x));
28 * ```
29 *
30 * @see {@link audit}
31 * @see {@link debounce}
32 * @see {@link sampleTime}
33 * @see {@link throttle}
34 *
35 * @param {Observable<any>} notifier The Observable to use for sampling the
36 * source Observable.
37 * @return {Observable<T>} An Observable that emits the results of sampling the
38 * values emitted by the source Observable whenever the notifier Observable
39 * emits value or completes.
40 * @method sample
41 * @owner Observable
42 */
43export declare function sample<T>(notifier: Observable<any>): MonoTypeOperatorFunction<T>;
Note: See TracBrowser for help on using the repository browser.