Originally published at coreycleary.me. This is a cross-post from my content blog. I publish new content every week or two, and you can sign up to ...
For further actions, you may consider blocking this person and/or reporting abuse
Nice article, thanks!
I'd also highly recommend using the caolan/async package. It implements asynchronous functions such as
each
(iteration),whilst
anduntil
(conditional), andwaterfall
(chaining), among many others. It also has utilities for composing those functions, and many of them have series and parallel variants where appropriate.It supports
async/await
and promises, as well as callbacks (when you must). I think it's a great additional tool for async programming with JS, especially with Node.js.Hope this helps, and cheers!
Thank you Corey for the post~ 🙂
I can think of using the principles in this article and apply on a web page.
Say, if one needs to display a part of webpage as quickly as possible, then we can use the sequential route.
If all contents need to be displayed at once, then concurrently.
Would the application work by chance?
Hey Sung, yeah I think thats accurate. For fetching things needed for certain parts of the webpage, doing it in series/sequentially will work as long as you load them in the right order (i.e. - the component that needs its data fetched first has its function run before the others)
Thank you for the clarification, Corey~ 🤜