Opal-Estate-Pro/node_modules/rxjs/operators/mapTo.d.ts

29 lines
1.1 KiB
TypeScript
Raw Normal View History

2019-09-13 04:44:33 +02:00
import { OperatorFunction } from '../interfaces';
/**
* Emits the given constant value on the output Observable every time the source
* Observable emits a value.
*
* <span class="informal">Like {@link map}, but it maps every source value to
* the same output value every time.</span>
*
* <img src="./img/mapTo.png" width="100%">
*
* Takes a constant `value` as argument, and emits that whenever the source
* Observable emits a value. In other words, ignores the actual source value,
* and simply uses the emission moment to know when to emit the given `value`.
*
* @example <caption>Map every click to the string 'Hi'</caption>
* var clicks = Rx.Observable.fromEvent(document, 'click');
* var greetings = clicks.mapTo('Hi');
* greetings.subscribe(x => console.log(x));
*
* @see {@link map}
*
* @param {any} value The value to map each source value to.
* @return {Observable} An Observable that emits the given `value` every time
* the source Observable emits something.
* @method mapTo
* @owner Observable
*/
export declare function mapTo<T, R>(value: R): OperatorFunction<T, R>;