Skip to content
This repository was archived by the owner on Oct 1, 2018. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 74 additions & 3 deletions src/operator-docs/combination/mergeAll.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,77 @@
import { OperatorDoc } from '../operator.model';
import { OperatorDoc } from "../operator.model";

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.

Copy link
Collaborator Author

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.


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"
]
};