You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
asyncfunctiontimeout(seconds){if(seconds>0){letresult=awaitnewPromise(resolve=>{setTimeout(()=>{console.log(`await 代码执行完毕`);resolve(`hello world`);},seconds*1e3);});console.log(`我是 await 后面的代码`);returnresult;}else{throw`TypeError: \`seconds\` should be a number, and more than zero`;}}timeout(1).then(res=>console.log(`输出结果:`,res));console.log(`虽然在后面,但我先执行`);
Activity