RxJs Set Interval

RxJs Set Interval
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
import {
concat,
map,
interval,
take,
takeUntil,
exhaustMap,
catchError,
of,
} from "rxjs";

const stop$ = new Subject<string>();

concat(
interval(1000).pipe(takeUntil(stop$), take(1)),
interval(1000 * 3).pipe(
takeUntil(stop$),
take(1),
map(() => {
return 4;
})
),
interval(1000).pipe(
map(() => {
return 1;
})
)
)
.pipe(
takeUntil(stop$),
exhaustMap(() => {
return fetch();
}),
catchError((error) => {
console.log(error);
return of(null);
})
)
.subscribe(() => {
// code
});

RxJs Set Interval
https://tedding.dev/2023/05/30/1886c590790.html
作者
TED.DING
发布于
2023年5月30日
许可协议