Currently, I have a service which requests data and returns an Observable
. To continuously replay this request after a delay time, I am utilizing the repeatWhen
method as shown below:
this.delay = 2000;
var observ = this.myService.getData()
.repeatWhen(completed => completed.delay(this.delay));
this.mySubscription = observ.subscribe(val => this.handleResponse(val));
My goal is to dynamically modify the value of the delay
, perhaps within the handleResponse
method. How can I go about achieving this?
Here's a rough example in pseudo code for what I aim to do:
private handleResponse(val: boolean) {
if(val)
this.delay += 2000;
}