|
1 | 1 | import { OperatorDoc } from '../operator.model'; |
2 | 2 |
|
3 | 3 | 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'] |
6 | 67 | }; |
0 commit comments