I need to recursively call a function itself inside a .then() method. Something like this:
function poll(params) {
const returned_promise = read_from_backend(some_url, some_params);
returned_promise
.then(some_process_func)
.then(r => {
poll(some_params); // recursive call
})
}
poll(starting_params);
Is there a way to write this algorithm in a while loop, without blocking the main thread?