Ohm-Management - Projektarbeit B-ME
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.

sample.d.ts 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { Observable } from '../Observable';
  2. import { 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. * ```javascript
  21. * const seconds = interval(1000);
  22. * const clicks = fromEvent(document, 'click');
  23. * const result = seconds.pipe(sample(clicks));
  24. * result.subscribe(x => console.log(x));
  25. * ```
  26. *
  27. * @see {@link audit}
  28. * @see {@link debounce}
  29. * @see {@link sampleTime}
  30. * @see {@link throttle}
  31. *
  32. * @param {Observable<any>} notifier The Observable to use for sampling the
  33. * source Observable.
  34. * @return {Observable<T>} An Observable that emits the results of sampling the
  35. * values emitted by the source Observable whenever the notifier Observable
  36. * emits value or completes.
  37. * @method sample
  38. * @owner Observable
  39. */
  40. export declare function sample<T>(notifier: Observable<any>): MonoTypeOperatorFunction<T>;