异步函数的封装 thunks

码农软件 · 软件分类 · 其他开发相关 · 2019-10-18 20:59:43

软件介绍

thunks 是一个虽小但却很有用的软件,它可用来封装所有异步函数。

概述:

  1. thunk 是一个被封装了同步或异步任务的函数;

  2. thunk 有唯一一个参数 callback,是 CPS 函数;

  3. thunk 运行后返回新的 thunk 函数,形成链式调用;

  4. thunk 自身执行完毕后,结果进入 callback 运行;

  5. callback 的返回值如果是 thunk 函数,则等该 thunk 执行完毕将结果输入新 thunk 函数运行;如果是其它值,则当做正确结果进入新的 thunk 函数运行;


本文地址:https://www.codercto.com/soft/d/17056.html

Data Structures and Algorithms

Data Structures and Algorithms

Alfred V. Aho、Jeffrey D. Ullman、John E. Hopcroft / Addison Wesley / 1983-1-11 / USD 74.20

The authors' treatment of data structures in Data Structures and Algorithms is unified by an informal notion of "abstract data types," allowing readers to compare different implementations of the same......一起来看看 《Data Structures and Algorithms》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具