You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
409 B
14 lines
409 B
2 years ago
|
# `Promise.limit` _(ext/promise/limit)_
|
||
|
|
||
|
Helps to limit concurrency of asynchronous operations.
|
||
|
|
||
|
```javascript
|
||
|
const limit = require("ext/promise/limit").bind(Promise);
|
||
|
|
||
|
const limittedAsyncFunction = limit(2, asyncFunction);
|
||
|
|
||
|
imittedAsyncFunction(); // Async operation started
|
||
|
imittedAsyncFunction(); // Async operation started
|
||
|
imittedAsyncFunction(); // On hold until one of previously started finalizes
|
||
|
```
|