Node.js Tutorials - 43 - Microtask Queues

preview_player
Показать описание

📱 Follow Codevolution

Microtask Queues
Рекомендации по теме
Комментарии
Автор

Don't know what you have to apologize for. The switches between the diagram and the code are fantastic and help more. Thank you

Invalid_Username
Автор

The first time I saw the diagram, I skipped the entire tutorial, but after a few months, I started watching it again. The phase and queues in Node JS are now clear to me... thank you so much!

muhammedsahad
Автор

Your teaching style is so so beautiful that I was able to predict the result. Thank you so much :)

spellsaif
Автор

Your explanation is the clearest one I've ever heard. Thanks a lot!

shorty
Автор

You are one of the best teachers I ever met, sir. Everything explained well and short to the point. Got it in one go and I got my confidence boosted!

NyanTint
Автор

Core concepts explained with a heart winning simplicity.

HarshVardhan-tkej
Автор

I magically got it right on the first try thanks to your great explanations.

gregthomas
Автор

Your teaching style is so so awesome. I'm able to predict the result. Thank you :)😀

sfhevmo
Автор

Really great explanation and on point with visual representation 👍

pradneshkhedekar
Автор

Thank you so much for this tutorial. It helped me a lot

ajilvc
Автор

Simply outstanding🔥. U made it easy to catch those complex concepts 🎉

bytescoder
Автор

your explanation is good that I got it right

nischalbista
Автор

It's been wonderful sir, and i got it right in the first try and you made it possible for me to guess <3

Shorts-zdhn
Автор

I always give your video a like before even watching it.

abdullah-ayyash
Автор

11:57 I thought the nested nextTick ("nextTick inside nextTick") will be executed in the next event loop iteration.

nithishnaidu
Автор

Hi, your explanation is the clearest one I've ever heard. Thank you very much, but can I ask you for this slide for reference?

MinhLe-owop
Автор

Got right for next tick, but little different for promise.resolve,

AlRashidashraf
Автор

According to my understanding, the global function will also be removed from the call stack before running any async code

qcswewl
Автор

How does call stack knows to which queue it should put callbacks to ???

jivanmainali
Автор

The nextTick queue takes precedence over the microtask queue, but the example in (5:50 to 8:35) is only half correct. In fact, if someone runs it as an ESM script (.mjs file or with type="module" in package.json), the output will always be:
2 -> 3 -> 1

That's because instead of executing it synchronously, node schedules it as a microtask callback (like wrapping everything in queueMicroTask(() => { ... }), kind of). So after executing the code, the event loop grabs the next callback in the microtask queue until it becomes empty before checking the nextTick queue.

Same thing for the 2nd example. Output for ESM would be:
promise 1
promise 2
promise 3
nextTick 1
nextTick 2
nextTick 3
nextTick inside Promise
nextTick inside nextTick

privateanon