javascript - Are there significant differences between the chrome browser event loop versus the node event loop? -


philip roberts brilliant job explaining browser event loop here providing clear explanation between call stack, event loop, task queue, , "outside" threads webapis. question these parallel equivalent components in node event loop , called same thing. is, when make call using node's file , web i/o libraries, these things happen outside stack callbacks queued in task queue?

...when make call using node's file , web i/o libraries, these things happen outside stack callbacks queued in task queue?

yes, absolutely; they're asynchronous ajax , settimeout asynchronous. perform operation outside of call stack, , when they've finished operation, add event queue processed event loop.

node's api provides kind of asynchronous no-op, setimmediate. function, "some operation" i've mention above "do nothing", after item added end of event queue.

there more powerful process.nexttick adds event front of event queue, cutting in line , making other queued events wait. if called recursively, can cause prolonged delay other events (until reaching maxtickdepth).


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

django - CSRF verification failed. Request aborted. CSRF cookie not set -