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

Commit c551eca

Browse files
Merge pull request #185 from ashwin-sureshkumar/issue-102
docs(operators): add documentation for takeUntil
2 parents f075468 + 1b92621 commit c551eca

File tree

1 file changed

+63
-2
lines changed

1 file changed

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

33
export const takeUntil: OperatorDoc = {
4-
'name': 'takeUntil',
5-
'operatorType': 'filtering'
4+
name: 'takeUntil',
5+
operatorType: 'filtering',
6+
signature: 'public takeUntil(notifier: Observable): Observable<T>',
7+
useInteractiveMarbles: true,
8+
parameters: [
9+
{
10+
name: 'notifier',
11+
type: 'Observable',
12+
attribute: '',
13+
description: `The Observable whose first emitted value will cause the output Observable of takeUntil
14+
to stop emitting values from the source Observable.`
15+
}
16+
],
17+
marbleUrl: 'http://reactivex.io/rxjs/img/takeUntil.png',
18+
shortDescription: {
19+
description:
20+
'Emits the values emitted by the source Observable until a notifier Observable emits a value.',
21+
extras: [
22+
{
23+
type: 'Tip',
24+
text: `
25+
Lets values pass until a second Observable, notifier, emits something. Then, it completes.
26+
`
27+
}
28+
]
29+
},
30+
walkthrough: {
31+
description: `
32+
<p>
33+
<code>takeUntil</code> subscribes and begins mirroring the source Observable.
34+
</p>
35+
<p>
36+
It also monitors a second Observable, notifier that you provide.
37+
If the notifier emits a value or a complete notification, the output Observable stops mirroring the source Observable and completes.
38+
</p>
39+
40+
`
41+
},
42+
examples: [
43+
{
44+
name: 'Tick every second until the first click happens',
45+
code: `
46+
const interval = Rx.Observable.interval(1000);
47+
const clicks = Rx.Observable.fromEvent(document, 'click');
48+
const result = interval.takeUntil(clicks);
49+
result.subscribe(x => console.log(x));
50+
51+
// Logs the number of seconds since the stream started.
52+
// Stream will end as soon as a click action is performed
53+
// anywhere in the document
54+
55+
// 1
56+
// 2
57+
// 3
58+
// ...
59+
`,
60+
externalLink: {
61+
platform: 'JSBin',
62+
url: 'http://jsbin.com/rujeci/embed?html,js,console,output'
63+
}
64+
}
65+
],
66+
relatedOperators: ['take', 'takeLast', 'takeWhile', 'skip']
667
};

0 commit comments

Comments
 (0)