Combination of async function + await + setTimeout

前端 未结 12 1531
予麋鹿
予麋鹿 2020-11-22 04:34

I am trying to use the new async features and I hope solving my problem will help others in the future. This is my code which is working:

  async function as         


        
12条回答
  •  花落未央
    2020-11-22 05:13

    The quick one-liner, inline way

     await new Promise(resolve => setTimeout(resolve, 1000));
    

提交回复
热议问题