a zip code crypto-currency system good for red ONLY

audit.d.ts 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import { SubscribableOrPromise } from '../Observable';
  2. import { MonoTypeOperatorFunction } from '../interfaces';
  3. /**
  4. * Ignores source values for a duration determined by another Observable, then
  5. * emits the most recent value from the source Observable, then repeats this
  6. * process.
  7. *
  8. * <span class="informal">It's like {@link auditTime}, but the silencing
  9. * duration is determined by a second Observable.</span>
  10. *
  11. * <img src="./img/audit.png" width="100%">
  12. *
  13. * `audit` is similar to `throttle`, but emits the last value from the silenced
  14. * time window, instead of the first value. `audit` emits the most recent value
  15. * from the source Observable on the output Observable as soon as its internal
  16. * timer becomes disabled, and ignores source values while the timer is enabled.
  17. * Initially, the timer is disabled. As soon as the first source value arrives,
  18. * the timer is enabled by calling the `durationSelector` function with the
  19. * source value, which returns the "duration" Observable. When the duration
  20. * Observable emits a value or completes, the timer is disabled, then the most
  21. * recent source value is emitted on the output Observable, and this process
  22. * repeats for the next source value.
  23. *
  24. * @example <caption>Emit clicks at a rate of at most one click per second</caption>
  25. * var clicks = Rx.Observable.fromEvent(document, 'click');
  26. * var result = clicks.audit(ev => Rx.Observable.interval(1000));
  27. * result.subscribe(x => console.log(x));
  28. *
  29. * @see {@link auditTime}
  30. * @see {@link debounce}
  31. * @see {@link delayWhen}
  32. * @see {@link sample}
  33. * @see {@link throttle}
  34. *
  35. * @param {function(value: T): SubscribableOrPromise} durationSelector A function
  36. * that receives a value from the source Observable, for computing the silencing
  37. * duration, returned as an Observable or a Promise.
  38. * @return {Observable<T>} An Observable that performs rate-limiting of
  39. * emissions from the source Observable.
  40. * @method audit
  41. * @owner Observable
  42. */
  43. export declare function audit<T>(durationSelector: (value: T) => SubscribableOrPromise<any>): MonoTypeOperatorFunction<T>;