p-limit:在有限的并发下运行多个承诺返回和异步功能

时间:2021-05-06 09:21:56
【文件属性】:
文件名称:p-limit:在有限的并发下运行多个承诺返回和异步功能
文件大小:8KB
文件格式:ZIP
更新时间:2021-05-06 09:21:56
JavaScript p极限 在有限的并发下运行多个承诺返回和异步功能 安装 $ npm install p-limit 用法 const pLimit = require ( 'p-limit' ) ; const limit = pLimit ( 1 ) ; const input = [ limit ( ( ) => fetchSomething ( 'foo' ) ) , limit ( ( ) => fetchSomething ( 'bar' ) ) , limit ( ( ) => doSomething ( ) ) ] ; ( async ( ) => { // Only one promise is run at once const result = await Promise . all ( input ) ; console . log ( result ) ; } ) (
【文件预览】:
p-limit-main
----index.test-d.ts(527B)
----.gitattributes(19B)
----.github()
--------funding.yml(113B)
--------security.md(179B)
--------workflows()
----test.js(3KB)
----license(1KB)
----index.d.ts(1KB)
----.npmrc(19B)
----.editorconfig(175B)
----.gitignore(23B)
----index.js(1KB)
----readme.md(3KB)
----package.json(928B)

网友评论