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.

mapTo.d.ts 1.1KB

12345678910111213141516171819202122232425262728293031323334
  1. import { OperatorFunction } from '../types';
  2. /**
  3. * Emits the given constant value on the output Observable every time the source
  4. * Observable emits a value.
  5. *
  6. * <span class="informal">Like {@link map}, but it maps every source value to
  7. * the same output value every time.</span>
  8. *
  9. * ![](mapTo.png)
  10. *
  11. * Takes a constant `value` as argument, and emits that whenever the source
  12. * Observable emits a value. In other words, ignores the actual source value,
  13. * and simply uses the emission moment to know when to emit the given `value`.
  14. *
  15. * ## Example
  16. * Map every click to the string 'Hi'
  17. * ```ts
  18. * import { fromEvent } from 'rxjs';
  19. * import { mapTo } from 'rxjs/operators';
  20. *
  21. * const clicks = fromEvent(document, 'click');
  22. * const greetings = clicks.pipe(mapTo('Hi'));
  23. * greetings.subscribe(x => console.log(x));
  24. * ```
  25. *
  26. * @see {@link map}
  27. *
  28. * @param {any} value The value to map each source value to.
  29. * @return {Observable} An Observable that emits the given `value` every time
  30. * the source Observable emits something.
  31. * @method mapTo
  32. * @owner Observable
  33. */
  34. export declare function mapTo<T, R>(value: R): OperatorFunction<T, R>;