【文件属性】:
文件名称:makefun:promise在不等待的情况下使用承诺值
文件大小:78KB
文件格式:ZIP
更新时间:2021-04-09 07:06:26
promise async-await promise-chain JavaScript
在不等待的情况下满意时使用承诺值
•••
•••
安装
npm i makefun -S
yarn add makefun
问题
有时,一旦实现了承诺,您就想使用承诺值。 该库可帮助您使用本机的Promise机制来实现此目标。
以下示例向您展示了此库为何有用的原因。 我们将引导您完成该示例,并在必要时提供说明。 请注意,可以在/examples/index.js获得相同示例的可运行版本。
假设您有各种实用程序函数来查询数据库。
const queryUserInfo = async ( ) => ( {
username : '@abumusamq'
} ) ;
const queryAccountInfo = async ( user ) => ( {
user ,
created : '19-02-2020'
} ) ;
注意, queryAccountInfo需
【文件预览】:
makefun-master
----.gitignore(2KB)
----package.json(932B)
----package-lock.json(60KB)
----src()
--------index.js(4KB)
----.travis.yml(239B)
----assets()
--------logo.png(52KB)
----LICENSE(663B)
----examples()
--------solution.js(361B)
--------index.js(707B)
--------override-options.js(1KB)
--------example-utils.js(1KB)
--------problem.js(201B)
--------babel()
--------default.js(434B)
----README.md(7KB)
----tests()
--------index.js(4KB)