katoikia-app/web-ui/web-react/node_modules/ext/docs/promise/limit.md

14 lines
409 B
Markdown
Raw Normal View History

2022-07-06 04:15:11 +00:00
# `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
```