为什么await能防止InfiniteScroll 无限调用呢? #5455
-
async function log(time) {
setTimeout(function () {
console.log(time)
return 1
}, time)
}
function log(time) {
return new Promise((resolve, reject) => {
setTimeout(function () {
console.log(time)
resolve(1)
}, time)
})
}
async function fun() {
console.log(await log(2000));
log(1000)
console.log(1)
}
fun() |
Beta Was this translation helpful? Give feedback.
Answered by
IronKinoko
Jul 8, 2022
Replies: 1 comment
-
你提供的两个 log 函数不是等效的,可以阅读 async 文档 |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
GOWxx
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
你提供的两个 log 函数不是等效的,可以阅读 async 文档