G
G
Gleb2019-03-26 19:38:57
JavaScript
Gleb, 2019-03-26 19:38:57

How in RxJS to make a periodic call at n times, only after the completion of the current iteration?

How to do blocking spacing in rxjs in angular http-client? That is, you need to run the request after the completion of the current one after n time, and so on again.
I have ideas how to do it, but it looks very crutch.
Please note that the server responds within 3-20 seconds, and the update interval is about 20 seconds. That is, the usual interval is not suitable here.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Demian Smith, 2019-03-27
@winox

Something like this:

this.httpClient.request(...).pipe(
  repeatWhen(complete => complete.pipe(delay(20000))
).subscribe(result => console.log(result))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question