async

https://www.npmjs.com/package/async

Async is a utility module which provides straight-forward, powerful functions for working with asynchronous JavaScript. Although originally designed for use with Node.js and installable via npm install async, it can also be used directly in the browser. A ESM version is included in the main async package that should automatically be used with compatible bundlers such as Webpack and Rollup.

A pure ESM version of Async is available as async-es.

For Documentation, visit https://caolan.github.io/async/

For Async v1.5.x documentation, go HERE

API

https://github.com/caolan/async/blob/v1.5.2/README.md#waterfall

Control Flow

动画

https://github.com/fanqingsong/async_animation

index.js

import './css/style.css';
import './sass/index.scss'; var async = require("async"); window.onload = () => {
let salutions = document.querySelectorAll("#salutions>div");
for(let one of salutions){
one.style.display = "none";
} async.waterfall([
function(callback) {
salutions[0].style.display = "flex"; setTimeout(callback, 1000);
},
function(callback) {
salutions[1].style.display = "flex"; setTimeout(callback, 1000);
},
function(callback) {
salutions[2].style.display = "flex"; setTimeout(callback, 1000);
},
function(callback) {
salutions[3].style.display = "flex"; setTimeout(callback, 1000);
},
function(callback) {
callback(null);
}
], function (err, result) {
// result now equals 'done'
});
};

html

    <div class="c-Sticky">
<div class="c-Sticky-bd">
<h1 style="text-align: center;">Async Show</h1> <div id="salutions" style="font-size: xx-large; color:blue; display: flex; justify-content:center;">
<div style="display:flex;width:200px;height:200px; justify-content:center;align-items: center ; margin: 5px; background-color: steelblue">你</div>
<div style="display:flex;width:200px;height:200px; justify-content:center;align-items: center ; margin: 5px; background-color: antiquewhite">好</div>
<div style="display:flex;width:200px;height:200px; justify-content:center;align-items: center ; margin: 5px; background-color: azure">中</div>
<div style="display:flex;width:200px;height:200px; justify-content:center;align-items: center ; margin: 5px; background-color: beige">国</div>
</div> </div>
</div>

效果

显示从左到右每个一秒显示一个方块字。

async异步流程控制神器的更多相关文章

  1. nodejs进阶(7)—async异步流程控制

    Async介绍 Async是一个流程控制工具包,提供了直接而强大的异步功能.基于Javascript为Node.js设计,同时也可以直接在浏览器中使用. Async提供了大约20个函数,包括常用的 m ...

  2. async 异步流程控制规则

    github 学习async网址 : https://github.com/caolan/async/ 1.Async 函数介绍 async 主要实现了三个部分的流程控制功能 1.集合:Collect ...

  3. async异步流程控制

    http://cnodejs.org/topic/54acfbb5ce87bace2444cbfb 先安装:G:\www\nodejs\one\models>npm install async ...

  4. Nodejs中使用异步流程控制Async

    首先,我们都知道,Node基于事件驱动的异步I/O架构,所谓异步就是非阻塞,说白了就是一个事件执行了,我不必等待它执行完成后我才能执行下一个事件.所以在Node环境中的模块基本都是异步的,上一篇说到我 ...

  5. 【javascript】Promise/A+ 规范简单实现 异步流程控制思想

    ——基于es6:Promise/A+ 规范简单实现 异步流程控制思想  前言: nodejs强大的异步处理能力使得它在服务器端大放异彩,基于它的应用不断的增加,但是异步随之带来的嵌套.难以理解的代码让 ...

  6. node核心:异步流程控制

    Node.js的异步是整个学习Node.js过程中重中之重. 1)异步流程控制学习重点 2)Api写法:Error-first Callback 和 EventEmitter 3)中流砥柱:Promi ...

  7. 使用yield进行异步流程控制

    现状 目前我们对异步回调的解决方案有这么几种:回调,deferred/promise和事件触发.回调的方式自不必说,需要硬编码调用,而且有可能会出现复杂的嵌套关系,造成"回调黑洞" ...

  8. js 异步流程控制之 avQ(avril.queue)

    废话前言 写了多年的js,遇到过最蛋疼的事情莫过于callback hell, 相信大家也感同身受. 业界许多大大也为此提出了很多不错的解决方案,我所了解的主要有: 朴灵 event proxy, 简 ...

  9. 异步流程控制库GoWithTheFlow

    异步流程控制库GoWithTheFlow 一个尾触发方式来控制异步流程的库, 有seq(顺序执行) par(同步执行) 两种方法 博客 http://notes.jetienne.com/2011/0 ...

随机推荐

  1. 你的Mac还安全吗

    MacOS 系统重大安全漏洞:不用密码我也可以玩你的 Macbook Wi-Fi 网络安全保护机制被攻破.Android 泄漏终端设备的用户声音和屏幕活动.iOS 出 bug,Office更是漏洞不断 ...

  2. selenium入门知识

    自动化测试 重复测试.性能测试.压力测试 快速.可靠.可重复.可程序化.广泛的 自动化测试适合场合 回归测试.更多更频繁的测试.手工测试无法实现的工作.跨平台产品的测试.重复性很强的操作 不适合场合 ...

  3. 项目Alpha冲刺随笔集合

    班级:软件工程1916|W 作业:项目Alpha冲刺 团队名称:SkyReach 目标:完成项目Alpha版本 项目Github地址 评审表 团队博客汇总 队员学号 队员姓名 个人博客地址 备注 22 ...

  4. 基于变分自编码器(VAE)利用重建概率的异常检测

    本文为博主翻译自:Jinwon的Variational Autoencoder based Anomaly Detection using Reconstruction Probability,如侵立 ...

  5. Nginx——跨域造成的504问题

    前言 前台域名和后台域名是两个不同不同的二级域名,访问的时候造成了跨域,出现了504错误 解决 修改Nginx配置,将超时的时间设置为1200秒 keepalive_timeout 1200; pro ...

  6. GeoIP简介与资源,定位经纬度,获取用户IP

    所谓GeoIP,就是通过来访者的IP,定位他的经纬度,国家/地区,省市,甚至街道等位置信息.这里面的技术不算难题,关键在于有个精准的数据库.有了准确的数据源就奇货可居赚点小钱,可是发扬合作精神,集体贡 ...

  7. Micro Benchmark Framework java 基准测试类库

    Micro Benchmark Framework 框架主要是method 层面上的 benchmark,精度可以精确到微秒级 比较典型的使用场景还有: 想定量地知道某个函数需要执行多长时间,以及执行 ...

  8. ABP 05 创建Model 以及 相应的增删改查

    在core层 添加一个model,如图 2.在 EntityFrameworkCore 层的 DbContext 中添加 Menu 3.编译一下 准备把新增的Model迁移到数据库 打开 程序包管理器 ...

  9. 洛谷 P1879 [USACO06NOV]玉米田Corn Fields 题解

    P1879 [USACO06NOV]玉米田Corn Fields 题目描述 Farmer John has purchased a lush new rectangular pasture compo ...

  10. ES6基础入门之let、const

    作者 | Jeskson来源 | 达达前端小酒馆 01 首先呢?欢迎大家来学习ES6入门基础let,const的基础知识内容.初始ECMA Script6. ESMAScript与JavaScript ...