|
|
||||
|---|---|---|---|---|
| .. | ||||
| index.js | 11e3a9652a | лет %!s(int64=7): %!d(string=назад) | ||
| license | 11e3a9652a | лет %!s(int64=7): %!d(string=назад) | ||
| package.json | 11e3a9652a | лет %!s(int64=7): %!d(string=назад) | ||
| readme.md | 11e3a9652a | лет %!s(int64=7): %!d(string=назад) | ||
Run multiple promise-returning & async functions with limited concurrency
$ 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);
})();
Returns a limit function.
Type: number
Minimum: 1
Concurrency limit.
Returns the promise returned by calling fn.
Type: Function
Promise-returning/async function.
MIT © Sindre Sorhus