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

Commit ef7ea12

Browse files
authored
Merge branch 'master' into issue-91
2 parents 66596eb + e7bbcb2 commit ef7ea12

File tree

1 file changed

+53
-2
lines changed

1 file changed

+53
-2
lines changed

src/operator-docs/filtering/take.ts

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

33
export const take: OperatorDoc = {
4-
'name': 'take',
5-
'operatorType': 'filtering'
4+
name: 'take',
5+
operatorType: 'filtering',
6+
signature: 'public take(count: number): Observable<T>',
7+
useInteractiveMarbles: true,
8+
parameters: [
9+
{
10+
name: 'count',
11+
type: 'number',
12+
attribute: '',
13+
description: 'The maximum number of next values to emit.'
14+
}
15+
],
16+
marbleUrl: 'http://reactivex.io/rxjs/img/take.png',
17+
shortDescription: {
18+
description: `Emits only the first count values emitted by the source Observable.`,
19+
extras: [
20+
{
21+
type: 'Tip',
22+
text: `Takes the first count values from the source, then completes.`
23+
}
24+
]
25+
},
26+
walkthrough: {
27+
description: `<p>
28+
<span class="markdown-code">take</span> returns an Observable that emits only the first count values emitted by the source Observable.
29+
</p>
30+
<p>
31+
If the source emits fewer than count values then all of its values are emitted.
32+
After that, it completes, regardless if the source completes.
33+
</p>`
34+
},
35+
examples: [
36+
{
37+
name:
38+
'Take the first 5 seconds of an infinite 1-second interval Observable',
39+
code: `
40+
const interval = Rx.Observable.interval(1000);
41+
const five = interval.take(5);
42+
five.subscribe(x => console.log(x));
43+
// Logs below values
44+
// 0
45+
// 1
46+
// 2
47+
// 3
48+
// 4
49+
`,
50+
externalLink: {
51+
platform: 'JSBin',
52+
url: 'http://jsbin.com/yujema/embed?html,js,console'
53+
}
54+
}
55+
],
56+
relatedOperators: ['takeLast', 'takeUntil', 'takeWhile', 'skip']
657
};

0 commit comments

Comments
 (0)