首页 > 其他分享 >Typescript实现Sleep功能

Typescript实现Sleep功能

时间:2022-12-25 15:55:27浏览次数:64  
标签:功能 Typescript console log resolve Sleep 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()

标签:功能,Typescript,console,log,resolve,Sleep,test
From: https://www.cnblogs.com/shegb1997/p/17004119.html

相关文章