We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
function runAsync (x) { const p = new Promise(r => setTimeout(() => r(x, console.log(x)), 1000)) return p } Promise.race([runAsync(1), runAsync(2), runAsync(3)]) .then(res => console.log('result: ', res)) .catch(err => console.log(err)) // 1 // 'result: ' 1 // 2 // 3
race
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Promise 4 - 3
race
给某个异步请求设置超时时间, 并且在超时后执行相应的操作The text was updated successfully, but these errors were encountered: