我需要在 .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 循環中編寫這個算法,而不阻塞主線程?
將 Promise.then() 內的遞歸調用轉換為循環?
大話西游666
2023-09-28 16:09:32