我需要在 .then() 方法内递归调用函数本身。像这样的东西:
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);
有没有办法在 while 循环中编写这个算法,而不阻塞主线程?
不负相思意
相关分类