mirror of
https://github.com/JasonYANG170/IOTConnect-Web.git
synced 2024-11-27 14:16:34 +00:00
409 B
409 B
Promise.limit
(ext/promise/limit)
Helps to limit concurrency of asynchronous operations.
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