-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathrxjs.js
More file actions
35 lines (32 loc) · 764 Bytes
/
rxjs.js
File metadata and controls
35 lines (32 loc) · 764 Bytes
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
import { map, tap, catchError, switchMap, filter } from 'rxjs/operators';
source()
.pipe(
map(x => x + 'foo'),
map(x => x + 'bar'),
catchError(err => {})
)
.subscribe(data => {
sink(data)
});
source()
.pipe(
map(x => x + 'foo'),
// `tap` taps into the source observable, so like `subscribe` but inside the pipe.
tap(x => sink(x)),
tap(x => sink(x)),
catchError(err => {})
)
.subscribe(data => {
sink(data)
});
myIdentifier()
.pipe(
switchMap(x => source(x)),
filter(x => myFilter(x)),
tap(x => sink(x)),
catchError(err => {}),
map(x => x + 'foo')
)
.subscribe(data => {
sink(data)
});