Package Exports
- same-time-limit
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (same-time-limit) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
same-time-limit
Run tasks in parallel with a limit.
☁️ Installation
$ npm i --save same-time-limit📋 Example
const sameTimeLimit = require("same-time-limit");
sameTimeLimit([
cb => setTimeout(_ => cb(null, 42), 1000)
, cb => setTimeout(_ => cb(null, 43), 1000)
, cb => setTimeout(_ => cb(null, 44), 1000)
, cb => setTimeout(_ => cb(null, 45), 1000)
, cb => setTimeout(_ => cb(null, 46), 1000)
], 2, (err, data) => {
console.log(err || data);
});📝 Documentation
sameTimeLimit(tasks, limit, cb, store)
Runs async tasks in parallel but not more than a given limit in the same time.
Params
- Array
tasks: An array of async functions to call. Their first parameter should be the callback function. - Number
limit: The max count of functions to run in parallel. - Function
cb: The callback function. - Array
store: An optional array to store the data in. Ifnull, data won't be stored.
Return
- LimitIt The
LimitItinstance.
😋 How to contribute
Have an idea? Found a bug? See how to contribute.
💰 Donations
Another way to support the development of my open-source modules is to set up a recurring donation, via Patreon. 🚀
PayPal donations are appreciated too! Each dollar helps.
Thanks! ❤️
💫 Where is this library used?
If you are using this library in one of your projects, add it in this list. ✨
git-cloner—Clone multiple git repositories.