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

Commit a73d3b6

Browse files
committed
operator display tweaks
1 parent 68a52b1 commit a73d3b6

File tree

8 files changed

+77
-11
lines changed

8 files changed

+77
-11
lines changed

ngsw-manifest.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
{"url": "https://cdnjs.cloudflare.com/ajax/libs/web-animations/2.2.5/web-animations.min.js"},
88
{"url": "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.5.0/styles/monokai_sublime.min.css"},
99
{"url": "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.5.0/highlight.min.js"},
10-
{"url": "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.5.0/languages/typescript.min.js"}
10+
{"url": "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.5.0/languages/typescript.min.js"},
11+
{"url": "http://reactivex.io/rxjs/img/combineAll.png"},
12+
{"url": "http://reactivex.io/rxjs/img/combineLatest.png"}
1113
]
1214
}
1315
}

src/app/operators/components/additional-resources/additional-resources.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ <h2> Additional Resources </h2>
44
<a [href]="sourceUrl" target="_blank"> Source Code </a>
55
</li>
66
<li>
7-
<a [href]="specUrl" target="_blank"> Specs </a>
7+
<a [href]="specsUrl" target="_blank"> Specs </a>
88
</li>
99
<li *ngFor="let resource of additionalResources">
1010
<a [href]="resource.url" target="_blank"> {{ resource.description }} </a>

src/app/operators/components/additional-resources/additional-resources.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ import { OperatorReference } from '../../../../operator-docs';
99
export class AdditionalResourcesComponent {
1010
@Input() additionalResources: OperatorReference[];
1111
@Input() sourceUrl: string;
12+
@Input() specsUrl: string;
1213
}

src/app/operators/components/operator-examples/operator-examples.component.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,16 @@ <h3 [innerHTML]="example.name"></h3>
1414
[href]="link.url"
1515
target="_blank"
1616
*ngFor="let link of example.externalLinks">
17-
{{link.platform}}
17+
<mat-icon>open_in_new</mat-icon>
18+
<span>{{link.platform}}</span>
1819
</a>
19-
<span
20+
<button
2021
mat-menu-item
2122
ngxClipboard
2223
[cbContent]="example.code">
23-
Copy To Clipboard
24-
</span>
24+
<mat-icon>content_copy</mat-icon>
25+
<span>Copy To Clipboard</span>
26+
</button>
2527
</mat-menu>
2628
<pre [innerHTML]="example.code"></pre>
2729
</div>

src/app/operators/components/operator/operator.component.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ <h3 class="short-description" [innerHTML]="shortDescription"></h3>
3030
</app-related-operators>
3131
<app-additional-resources
3232
[additionalResources]="additionalResources"
33-
[sourceUrl]="sourceUrl">
33+
[sourceUrl]="sourceUrl"
34+
[specsUrl]="specsUrl">
3435
</app-additional-resources>
3536
</section>

src/app/operators/components/operator/operator.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export class OperatorComponent {
5353
return `${this.baseSourceUrl}/${this.operatorName}.ts`;
5454
}
5555

56-
get specUrl() {
56+
get specsUrl() {
5757
return `${this.baseSpecUrl}/${this.operatorName}-spec.js.html`;
5858
}
5959

src/operator-docs/combination/combineAll.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,13 @@ export const combineAll: OperatorDoc = {
5050
const clicks = Rx.Observable.fromEvent(document, 'click');
5151
const higherOrder = clicks.map(ev =>
5252
Rx.Observable.interval(Math.random()*2000).take(3)
53-
).take(2);
53+
)
54+
.take(2);
5455
const result = higherOrder.combineAll();
5556
result.subscribe(x => console.log(x));
5657
`,
5758
'externalLinks': [
58-
{ 'platform': 'JSBin', 'url': 'test'},
59+
{ 'platform': 'JSBin', 'url': 'jsbin.com'},
5960
{ 'platform': 'JSFiddle', 'url': 'https://jsfiddle.net/sba9k56v/'}
6061
]
6162
}

src/operator-docs/combination/combineLatest.ts

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,64 @@ import { OperatorDoc } from '../operator.model';
22

33
export const combineLatest: OperatorDoc = {
44
'name': 'combineLatest',
5-
'operatorType': 'combination'
5+
'operatorType': 'combination',
6+
'signature': 'public combineLatest(observables: ...Observable, project: function): Observable',
7+
'parameters': [
8+
{
9+
'name': 'other',
10+
'type': 'Observable',
11+
'attribute': '',
12+
'description': 'An input Observable to combine with the source Observable. More than one input Observables may be given as argument.'
13+
},
14+
{
15+
'name': 'other',
16+
'type': 'function',
17+
'attribute': 'optional',
18+
'description': 'An optional function to project the values from the combined latest values into a new value on the output Observable.'
19+
}
20+
],
21+
'marbleUrl': 'http://reactivex.io/rxjs/img/combineLatest.png',
22+
'shortDescription': {
23+
'description': 'Combines multiple Observables to create an Observable whose values are calculated from the latest values of each of its input Observables.',
24+
'extras': [
25+
{ 'type': 'Tip', 'text': 'This operator can be used as either a static or instance method!' },
26+
{ 'type': 'Tip', 'text': '<a class="markdown-code" href="/operators#combineAll">combineAll</a> can be used to apply <span class="markdown-code">combineLatest</span> to emitted observables when a source completes!' }
27+
]
28+
},
29+
'walkthrough': {
30+
'description': `
31+
<p>
32+
<span class="markdown-code">combineLatest</span> combines the values from this Observable with values from
33+
Observables passed as arguments. This is done by subscribing to each
34+
Observable, in order, and collecting an array of each of the most recent
35+
values any time any of the input Observables emits, then either taking that
36+
array and passing it as arguments to an optional <span class="markdown-code">project</span> function and
37+
emitting the return value of that, or just emitting the array of recent
38+
values directly if there is no <span class="markdown-code">project</span> function.
39+
</p>
40+
`
41+
},
42+
'examples': [
43+
{
44+
'name': 'Dynamically calculate the Body-Mass Index from an Observable of weight and one for height',
45+
'code': `
46+
const weight = Rx.Observable.of(70, 72, 76, 79, 75);
47+
const height = Rx.Observable.of(1.76, 1.77, 1.78);
48+
const bmi = weight.combineLatest(height, (w, h) => w / (h * h));
49+
/*
50+
Output:
51+
BMI is 24.212293388429753
52+
BMI is 23.93948099205209
53+
BMI is 23.671253629592222
54+
*/
55+
bmi.subscribe(x => console.log('BMI is ' + x));
56+
`,
57+
'externalLinks': [
58+
{ 'platform': 'JSBin', 'url': 'jsbin.com'},
59+
{ 'platform': 'JSFiddle', 'url': 'https://jsfiddle.net/sba9k56v/'}
60+
]
61+
}
62+
],
63+
'relatedOperators': [ 'combineAll', 'merge', 'withLatestFrom' ],
64+
'additionalResources': []
665
};

0 commit comments

Comments
 (0)