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 62
/
Copy pathconcatAll.ts
74 lines (72 loc) · 2.27 KB
/
concatAll.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import { OperatorDoc } from '../operator.model';
export const concatAll: OperatorDoc = {
name: 'concatAll',
operatorType: 'combination',
returnValue: 'Observable',
signature: 'public concatAll(): Observable',
parameters: [],
marbleUrl: 'http://reactivex.io/rxjs/img/concatAll.png',
shortDescription: {
description:
'Converts a higher-order Observable into a first-order Observable by concatenating the inner Observables in order.',
extras: [
{
type: 'Tip',
text:
'Flattens an Observable-of-Observables by putting one inner Observable after the other.'
}
]
},
walkthrough: {
description: `
Joins every Observable emitted by the source (a higher-order Observable), in a serial fashion.
It subscribes to each inner Observable only after the previous inner Observable has completed,
and merges all of their values into the returned observable.
`,
extras: [
{
type: 'Warning',
text: `
If the source Observable emits Observables quickly and endlessly, and the inner Observables it emits generally
complete slower than the source emits, you can run into memory issues as the incoming Observables collect in an unbounded buffer.
`
},
{
type: 'Tip',
text: `concatAll is equivalent to mergeAll with concurrency parameter set to 1.`
}
]
},
examples: [
{
name:
'For each click event, tick every second from 0 to 3, with no concurrency',
code: `
import { map, take, concatAll } from 'rxjs/operators';
import { fromEvent } from 'rxjs/observable/fromEvent';
import { interval } from 'rxjs/observable/interval';
const clicks = fromEvent(document, 'click');
const higherOrder = clicks.pipe(
map(ev => interval(1000).pipe(take(4)))
);
const firstOrder = higherOrder.pipe(concatAll());
firstOrder.subscribe(x => console.log(x));
`,
externalLink: {
platform: 'JSBin',
url: 'http://jsbin.com/guhefeyahi/embed?js,console,output'
}
}
],
relatedOperators: [
'combineAll',
'concat',
'concatMap',
'concatMapTo',
'exhaust',
'mergeAll',
'switch',
'zipAll'
],
additionalResources: []
};