Angular RxJS-如何在不使用间隔的情况下增加延迟时间?

Angular RxJS-如何在不使用间隔的情况下增加延迟时间?,angular,rxjs,rxjs5,rxjs6,rxjs-observables,Angular,Rxjs,Rxjs5,Rxjs6,Rxjs Observables,我想逐步增加这方面的延迟: const source = from(839283, 1123123, 63527, 4412454); // note: this is random const spread = source.pipe(concatMap(value => of(value).pipe(delay(1000)))); // how to incrementally increase the delay where the first item emits in a sec

我想逐步增加这方面的延迟:

const source = from(839283, 1123123, 63527, 4412454); // note: this is random
const spread = source.pipe(concatMap(value => of(value).pipe(delay(1000)))); // how to incrementally increase the delay where the first item emits in a second, the second item emits in three seconds, the third item emits in five seconds, and the last item emits in seven seconds.
spread.subscribe(value => console.log(value));
我知道使用interval来递增延迟时间,如下所示。但我还需要使用这个source const source=from8392831123123635274412454


当以const source=从839283、1123123、63527、4412454;开始时,如何递增延迟时间

您可以使用发射值的索引,并根据该索引计算延迟

concatMapvalue,索引=>{ 返回value.pipedelayindex>2?7:索引*1000; } 下面是stackblitz的一个完整示例,其中包含您的代码片段:

您可以使用发射值的索引,并根据该索引计算延迟

concatMapvalue,索引=>{ 返回value.pipedelayindex>2?7:索引*1000; } 下面是stackblitz的一个完整示例,其中包含您的代码片段:

const source = interval(1000); // But I also need to use have this from(839283, 1123123, 63527, 4412454)
const spread = source.pipe(concatMap(value => of(value).pipe(delay(value * 200))));
spread.subscribe(value => console.log(value