docs: use static zip function as an Observable creator. (#26790)
The existing example makes it seem like zip is a pipeable operator. It can be used this way, but I think that is for backwards compatibility. You can achieve the same functionality by using it as an Observable creator. I think this also makes the example clearer. PR Close #26790
This commit is contained in:
parent
1c39ad38d3
commit
1de4031d9c
|
@ -5,10 +5,9 @@ import { retryWhen, map, mergeMap } from 'rxjs/operators';
|
||||||
|
|
||||||
function backoff(maxTries, ms) {
|
function backoff(maxTries, ms) {
|
||||||
return pipe(
|
return pipe(
|
||||||
retryWhen(attempts => range(1, maxTries)
|
retryWhen(attempts => zip(range(1, maxTries), attempts)
|
||||||
.pipe(
|
.pipe(
|
||||||
zip(attempts, (i) => i),
|
map(([i]) => i * i),
|
||||||
map(i => i * i),
|
|
||||||
mergeMap(i => timer(i * ms))
|
mergeMap(i => timer(i * ms))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue