currying
to pass callback , Is it a good practice or should I use call
?
fetch(...)
.then((results) => {
let list = ...
async.mapLimit(list, async (item) => ... );
return ... ?
/// ???
});
Hello, how do I use async.queue in a sequential manner?
I've read that for a static array of tasks, sequential execution can be achieved through async.series, if one requires push/pop, one should use queue instead. I've set up my queue as
const RequestQueue = queue(() => {}, 1);
but the 2nd item (a fetch request) always executes before the 1st item (also a fetch request) finishes.
Sample Task:
retrieveConnectionsTask = () => {
RequestWrapper.get("/myEndpoint")
.then(response =>
response.json()
)
.then(data => {
//doSomethingWithData
console.log("retrieveConnectionsTask Returned");
console.dir(this.state.connections);
})
.catch(error => console.log(error));
};
would appreciate any advice.
Thank you!
Hello everyone.
You might be interested by an open-source project I recently started which is basically a rewrite of Async.js but aimed for exclusive usage of async/await and promises.
The code is here: https://github.com/nicolas-van/modern-async
I would welcome any comment.
async
. Mine is iter-tools
, and it only focuses on iterables, but I think it has significant advantages. It ensures resources are released (by calling iterator.return()
if it is present), it has a better approach to parallelization, and it offers more performant implementations of methods over sync iterators. In 8.0
I plan to change my methods around a bit so that import { asyncMap } from 'iter-tools'
beceomes import { map } from 'iter-tools/async'
, which I think will be more familiar to users of this library.
setImmediate
which becomes setTimeout
in the browser. I'm having a hard time building the lib for testing though, even from a vanilla repo. What I've done:make
make: *** No rule to make target `build/all.js', needed by `build-modules'. Stop.
contributing
guide or anything like that, am I missing some setup steps?
task
btw? is it just meta info about a task or is it a function that is executed?