Typescript实现Sleep功能
原帖:https://blog.csdn.net/HumorChen99/article/details/118338631
export const Sleep = (ms)=> {
return new Promise(resolve=>setTimeout(resolve, ms))
}
async test(){
console.log(1)
await Sleep(1500)
console.log(2)
}
test()
原帖:https://blog.csdn.net/HumorChen99/article/details/118338631
export const Sleep = (ms)=> {
return new Promise(resolve=>setTimeout(resolve, ms))
}
async test(){
console.log(1)
await Sleep(1500)
console.log(2)
}
test()