This repository was archived by the owner on Oct 1, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 61
docs(operator-docs): Added MergeAll operator documentation #141
Merged
ashwin-sureshkumar
merged 1 commit into
ReactiveX:master
from
sumitarora:docs-merge-all
Nov 17, 2017
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,77 @@ | ||
| import { OperatorDoc } from '../operator.model'; | ||
| import { OperatorDoc } from "../operator.model"; | ||
|
|
||
| export const mergeAll: OperatorDoc = { | ||
| 'name': 'mergeAll', | ||
| 'operatorType': 'combination' | ||
| name: "mergeAll", | ||
| operatorType: "combination", | ||
| signature: "public mergeAll(concurrent: number): Observable", | ||
| parameters: [ | ||
| { | ||
| name: "concurrent", | ||
| type: "number", | ||
| attribute: "optional, default: Number.POSITIVE_INFINITY", | ||
| description: `Maximum number of input Observables being subscribed to concurrently.` | ||
| } | ||
| ], | ||
| marbleUrl: "http://reactivex.io/rxjs/img/mergeAll.png", | ||
| shortDescription: { | ||
| description: `Converts a higher-order Observable into a first-order Observable which concurrently | ||
| delivers all values that are emitted on the inner Observables`, | ||
| extras: [ | ||
| { | ||
| type: "Tip", | ||
| text: "Flattens an Observable-of-Observables." | ||
| } | ||
| ] | ||
| }, | ||
| walkthrough: { | ||
| description: ` | ||
| <p><code>MergeAll</code> subscribes to an Observable that emits Observables, | ||
| also known as a higher-order Observable. Each time it observes one of these emitted | ||
| inner Observables, it subscribes to that and delivers all the values from the inner | ||
| Observable on the output Observable. The output Observable only completes once all inner | ||
| Observables have completed. Any error delivered by a inner Observable will be immediately | ||
| emitted on the output Observable.</p> | ||
| ` | ||
| }, | ||
| examples: [ | ||
| { | ||
| name: | ||
| "Spawn a new interval Observable for each click event, and blend their outputs as one Observable", | ||
| code: ` | ||
| const clicks = Rx.Observable.fromEvent(document, 'click'); | ||
| const higherOrder = clicks.map((ev) => Rx.Observable.interval(1000)); | ||
| const firstOrder = higherOrder.mergeAll(); | ||
| firstOrder.subscribe(x => console.log(x)); | ||
| `, | ||
| externalLink: { | ||
| platform: "JSBin", | ||
| url: "http://jsbin.com/lebidefocu/1/edit?js,output" | ||
| } | ||
| }, | ||
| { | ||
| name: | ||
| "Count from 0 to 9 every second for each click, but only allow 2 concurrent timers", | ||
| code: ` | ||
| const clicks = Rx.Observable.fromEvent(document, 'click'); | ||
| const higherOrder = clicks.map((ev) => Rx.Observable.interval(1000).take(10)); | ||
| const firstOrder = higherOrder.mergeAll(2); | ||
| firstOrder.subscribe(x => console.log(x)); | ||
| `, | ||
| externalLink: { | ||
| platform: "JSBin", | ||
| url: "http://jsbin.com/kokezoribu/edit?js,output" | ||
| } | ||
| } | ||
| ], | ||
| relatedOperators: [ | ||
| "combineAll", | ||
| "concatAll", | ||
| "exhaust", | ||
| "merge", | ||
| "mergeMap", | ||
| "mergeMapTo", | ||
| "mergeScan", | ||
| "switch", | ||
| "zipAll" | ||
| ] | ||
| }; | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use single quote here. This will be handled automagically once #148 is merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xlozinguez It doesn't take effect as pre-commit hook change it to double quotes again. Probably would be done after #148 is merged.