且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何延迟分叉加入

更新时间:2022-05-02 16:07:21

使用 delay 运算符和 pipe 运算符

use the delay operator withe the pipe operator

import { delay, take } from 'rxjs/operators';
import { forkJoin } from 'rxjs/observable/forkJoin';
import { of } from 'rxjs/observable/of';

return forkJoin(
   of(call1()).pipe(delay(1000)),
   of(call2()).pipe(delay(2000)),
   of(call3()).pipe(delay(1000))
 );