promise-call-limit

WebJar for promise-call-limit

Лицензия

Лицензия

ISC
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

promise-call-limit
Последняя версия

Последняя версия

1.0.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

promise-call-limit
WebJar for promise-call-limit
Ссылка на сайт

Ссылка на сайт

https://www.webjars.org
Система контроля версий

Система контроля версий

https://github.com/isaacs/promise-call-limit

Скачать promise-call-limit

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/promise-call-limit/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>promise-call-limit</artifactId>
    <version>1.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/promise-call-limit/
implementation 'org.webjars.npm:promise-call-limit:1.0.1'
// https://jarcasting.com/artifacts/org.webjars.npm/promise-call-limit/
implementation ("org.webjars.npm:promise-call-limit:1.0.1")
'org.webjars.npm:promise-call-limit:jar:1.0.1'
<dependency org="org.webjars.npm" name="promise-call-limit" rev="1.0.1">
  <artifact name="promise-call-limit" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='promise-call-limit', version='1.0.1')
)
libraryDependencies += "org.webjars.npm" % "promise-call-limit" % "1.0.1"
[org.webjars.npm/promise-call-limit "1.0.1"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

promise-call-limit

Call an array of promise-returning functions, restricting concurrency to a specified limit.

USAGE

const promiseCallLimit = require('promise-call-limit')
const things = getLongListOfThingsToFrobulate()

// frobulate no more than 4 things in parallel
promiseCallLimit(things.map(thing => () => frobulateThing(thing)), 4)
  .then(results => console.log('frobulated 4 at a time', results))

API

promiseCallLimit(queue Array<() => Promise>, limit = defaultLimit)

The default limit is the number of CPUs on the system - 1, or 1.

The reason for subtracting one is that presumably the main thread is taking up a CPU as well, so let's not be greedy.

Note that the array should be a list of Promise-returning functions, not Promises themselves. If you have a bunch of Promises already, you're best off just calling Promise.all().

The functions in the queue are called without any arguments.

Версии библиотеки

Версия
1.0.1