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

12345678910111213141516171819202122232425262728293031
  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. * ```javascript
  18. * const clicks = fromEvent(document, 'click');
  19. * const greetings = clicks.pipe(mapTo('Hi'));
  20. * greetings.subscribe(x => console.log(x));
  21. * ```
  22. *
  23. * @see {@link map}
  24. *
  25. * @param {any} value The value to map each source value to.
  26. * @return {Observable} An Observable that emits the given `value` every time
  27. * the source Observable emits something.
  28. * @method mapTo
  29. * @owner Observable
  30. */
  31. export declare function mapTo<T, R>(value: R): OperatorFunction<T, R>;