Thanks for pointing out the difference between them!
One thing confuses me:
Finally, we have setTimeout. /* ... */, but it does run after I/0 events and after setImmediate.
So if it runs after setImmediate, why is timeout printed before immediate?
setImmediate
timeout
immediate
Clearly my model of how this works is wrong! I did some research in writing this, but the timeout is running first here.
Time to do some more investigation and revise this. Thanks!
Edit: setImmediate callbacks go into the "close" queue! I've updated the post.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks for pointing out the difference between them!
One thing confuses me:
So if it runs after
setImmediate
, why istimeout
printed beforeimmediate
?Clearly my model of how this works is wrong! I did some research in writing this, but the timeout is running first here.
Time to do some more investigation and revise this. Thanks!
Edit:
setImmediate
callbacks go into the "close" queue! I've updated the post.