question/implement-async-helper-parallel #39
Replies: 1 comment
-
/**
* @param {() => Promise<any>} fetcher
* @param {number} maximumRetryCount
* @return {Promise<any>}
*/
function fetchWithAutoRetry(fetcher, maximumRetryCount) {
return fetcher()
.catch((e) => {
if (maximumRetryCount) {
return fetchWithAutoRetry(fetcher, maximumRetryCount - 1);
} else {
throw e;
}
})
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
question/implement-async-helper-parallel
北美前端面试攻略
https://us-fe.github.io/question/implement-async-helper-parallel.html
Beta Was this translation helpful? Give feedback.
All reactions