Run a function in parallel, without going too fast.
Give it an array
, and a function
that returns a Promise.
then it tells you when it's done.
useful for courteous use of a web-service, or avoiding a blown-stack.
const slow = const randomWait = { return { }}slow
or, if you prefer, as async/await
;async { let res = await slow // ['larry', 'curly', 'moe']}
results are always in order.
one bad async call will not throw the whole operation, either.
Methods:
- slow.crawl(arr, fn) - max 3
- slow.walk(arr, fn) - max 5
- slow.run(arr, fn) - max 10
- slow.sprint(arr, fn) - max 15
- slow.one(arr, fn) - max 1
- slow.two(arr, fn) - max 2
In the browser: