Skip to content
This repository was archived by the owner on Oct 1, 2018. It is now read-only.

Commit 27890ec

Browse files
authored
Merge branch 'master' into bump-flex-layout
2 parents cc0130a + 9c8c064 commit 27890ec

File tree

1 file changed

+49
-2
lines changed
  • src/operator-docs/transformation

1 file changed

+49
-2
lines changed
Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,53 @@
11
import { OperatorDoc } from '../operator.model';
22

33
export const mapTo: OperatorDoc = {
4-
'name': 'mapTo',
5-
'operatorType': 'transformation'
4+
name: 'mapTo',
5+
operatorType: 'transformation',
6+
signature: 'public mapTo(value: any): Observable',
7+
parameters: [
8+
{
9+
name: 'value',
10+
type: 'any',
11+
attribute: '',
12+
description: `The value to map each source value to.`
13+
}
14+
],
15+
useInteractiveMarbles: true,
16+
marbleUrl: 'http://reactivex.io/rxjs/img/mapTo.png',
17+
shortDescription: {
18+
description: `Emits the given constant value on the output Observable every time the source Observable emits a value.`
19+
},
20+
walkthrough: {
21+
description: `<p>
22+
Takes a constant
23+
<code>value</code> as argument,
24+
and emits that whenever the source Observable emits a value.
25+
In other words, ignores the actual source value,
26+
and simply uses the emission moment to know when to emit the given
27+
<code>value</code>.
28+
<p>`
29+
},
30+
examples: [
31+
{
32+
name: "Map every click to the string 'Hi'",
33+
code: `
34+
import { fromEvent } from 'rxjs/observable/fromEvent';
35+
import { mapTo } from 'rxjs/operators';
36+
37+
const clicks = fromEvent(document, 'click');
38+
const greetings = clicks.pipe(mapTo('Hi');
39+
greetings.subscribe(x => console.log(x));
40+
/*
41+
Example console output:
42+
Hi
43+
*/
44+
`,
45+
externalLink: {
46+
platform: 'JSBin',
47+
url: 'http://jsbin.com/seyibe/embed?js,console,output'
48+
}
49+
}
50+
],
51+
relatedOperators: ['map'],
52+
additionalResources: []
653
};

0 commit comments

Comments
 (0)