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:
Andrew Crites 2018-10-26 16:25:00 -04:00 committed by Kara Erickson
parent 1c39ad38d3
commit 1de4031d9c
1 changed files with 2 additions and 3 deletions

View File

@ -5,10 +5,9 @@ import { retryWhen, map, mergeMap } from 'rxjs/operators';
function backoff(maxTries, ms) {
return pipe(
retryWhen(attempts => range(1, maxTries)
retryWhen(attempts => zip(range(1, maxTries), attempts)
.pipe(
zip(attempts, (i) => i),
map(i => i * i),
map(([i]) => i * i),
mergeMap(i => timer(i * ms))
)
)