M
M
mad_god2016-01-10 22:24:06
Node.js
mad_god, 2016-01-10 22:24:06

How will multiple asynchronous NodeJS functions be executed?

As I understand it, all asynchronous functions are queued. The question is, how will the functions be executed, each one will be completed to the end or one by one, until one of them reaches its completion and drops out of the queue, passing control to each other?
In other words, if we have three functions that are responsible for moving their rectangle in their direction vector(X,Y), will these rectangles move separately, first one to the end, then the other, then the third, or a little each, until arrive at their destination?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Litvinenko, 2016-01-10
@mad_god

Namely, as you described, the rectangles will move in turn and not in parallel.
The movement animation is parallel, it's actually a lot of consecutive animations that move each rectangle in turn by a bit.
In general, with the advent of generators, you can do interrupts within the same function.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question