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

Commit

Permalink
Merge pull request #186 from ashwin-sureshkumar/issue-101
Browse files Browse the repository at this point in the history
docs(operators): add documentation for take
  • Loading branch information
btroncone authored Dec 8, 2017
2 parents 8804ed5 + 3ec2696 commit e7bbcb2
Showing 1 changed file with 53 additions and 2 deletions.
55 changes: 53 additions & 2 deletions src/operator-docs/filtering/take.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,57 @@
import { OperatorDoc } from '../operator.model';

export const take: OperatorDoc = {
'name': 'take',
'operatorType': 'filtering'
name: 'take',
operatorType: 'filtering',
signature: 'public take(count: number): Observable<T>',
useInteractiveMarbles: true,
parameters: [
{
name: 'count',
type: 'number',
attribute: '',
description: 'The maximum number of next values to emit.'
}
],
marbleUrl: 'http://reactivex.io/rxjs/img/take.png',
shortDescription: {
description: `Emits only the first count values emitted by the source Observable.`,
extras: [
{
type: 'Tip',
text: `Takes the first count values from the source, then completes.`
}
]
},
walkthrough: {
description: `<p>
<span class="markdown-code">take</span> returns an Observable that emits only the first count values emitted by the source Observable.
</p>
<p>
If the source emits fewer than count values then all of its values are emitted.
After that, it completes, regardless if the source completes.
</p>`
},
examples: [
{
name:
'Take the first 5 seconds of an infinite 1-second interval Observable',
code: `
const interval = Rx.Observable.interval(1000);
const five = interval.take(5);
five.subscribe(x => console.log(x));
// Logs below values
// 0
// 1
// 2
// 3
// 4
`,
externalLink: {
platform: 'JSBin',
url: 'http://jsbin.com/yujema/embed?html,js,console'
}
}
],
relatedOperators: ['takeLast', 'takeUntil', 'takeWhile', 'skip']
};

0 comments on commit e7bbcb2

Please sign in to comment.