Open Sleepful opened 1 year ago
I was confused by this as well, I am glad I am not the only one. The documentation for this library isn't the greatest.
back in the old days, before promises got popular, we used the callback pattern to write async code. this pattern was so universal at that time that it did not make sense to document it here. here's a reference if you're curious about the pattern: https://nodejs.dev/en/learn/javascript-asynchronous-programming-and-callbacks/#handling-errors-in-callbacks
i'm hoping someone will come along and rewrite this module to be a bit more promise oriented since that's what most folks are using today... read #86 and send a pr!
That makes sense. I read some of your other comments and I ended up using Promise.all() instead of the queue library, but it was fun to play around with. Thanks for the knowledge on the callback pattern though!
from the docs:
so it is implied that the second parameter of
cb
should be the value that will end up onq.results
, but what does the first parameter ofcb
mean (withnull
value in the example)?I assume the first param would take an error if there was one. But I dunno.