avatar
文章
109
标签
41
分类
12
📝主页
📱作品
📬联系
🧑‍💻关于
👋Harry BlogAsync Await Promise Demo 返回首页
搜索
📝主页
📱作品
📬联系
🧑‍💻关于

Async Await Promise Demo

发表于2020-02-16|更新于2025-09-27|DevelopmentFrontend
|浏览量:

Video: https://harrywork.com/cos/site/blog/video/2020/promise.mp4

const delay = ms=>new Promise(r=>setTimeout(r,ms));
async function run(){
await delay(2000); console.log('step1');
await delay(1000); console.log('step2');
await delay(500); console.log('step3');
}
run();
文章作者: Harry
文章链接: https://harrywork.com/blog/p/50160/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 👋Harry Blog!
javascript
Thanks
  • Paypal
    Paypal
  • Wechat
    Wechat
cover of previous post
上一篇
PHP ZIPARCHIVE 压缩文件处理目录结构 PHP ZIPARCHIVE directory structure
PHP ZIPARCHIVE 压缩文件处理目录结构 Prevent directory structure in compressed package $flag = $zip->open($filePath, \ZIPARCHIVE::CREATE);if ($flag!== TRUE) { //if Linux,need check file authorization exit("open file err="+$flag);}//add test.php to zip file $zip->addFile('test.php');// run rename$zip->renameName('test.php','test.php');
cover of next post
下一篇
async await promise demo
async await promise 实例 video demo function step1(query) { return new Promise((success) => { let waiting=2000; setTimeout(() => { success('wait-time:'+waiting+' step:'+query); }, waiting); });}function step2(query) { return new Promise((success) => { let waiting=1000; setTimeout(() => { success('wait-time:'+waiting+' step:'+query)...
相关推荐
2015-07-15
pageX clientX screenX Differences
Distinguish between screen, page, and client mouse/touch coordinate properties in browsers.
2016-08-15
JS Detect Device and Platform via UserAgent
Legacy userAgent pattern matching to redirect mobile users; prefer feature detection today.

评论
avatar
Harry
文章
109
标签
41
分类
12
关于
最新文章
comfyui通过Api请求报错,通过comfyui界面执行正常2025-04-18
ComfyUI workflow fails via API but succeeds in UI2025-04-18
Edit Video Duration Metadata2025-03-16
修改视频元信息时长 duration修改2025-03-16
comfyui gemeni apikey 配置2025-03-15
© 2017 - 2025 By Harry
搜索
数据加载中