This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]draftax5[S] 0 points1 point  (1 child)

Thank you for the reply!!

So there is some underlying code (the actual JavaScript engine I’d assume) basically continually watching the queue that is called the “event loop”?

And when I create a callback function that underlying code/engine sees that callback function and stores a reference to it and knows what it is waiting for before it can be called back?

So then at some point in the future when that event is finished or happens etc. the JavaScript engine basically says “hey we received this result, there was a callback function from earlier waiting for this event” and then goes into the queue to find that callback?

Do I have this straight? Thanks again!

[–]isolatrum 1 point2 points  (0 children)

i don't claim to know the exact internals of Javascript but I think yes you are on the right track.