I understand that javascript is single thread and that any asynchronous task is executed only after the current stack is empty. Callbacks, setTimeout, promises, are executed only after the current function is completed.
I want to know how the browser calls my event handler function when I perform some events.
When we say we are registering an event, where are we registering it? (message queue, job queue)? Where does it get saved in memory and how does the browser know that some event has occurred?
Are events related to operating systems call?
I have watched the philip roberts video and I understood the functionality of the event loop.
I want to know internals of javascript.
Callbacks... are executed only after the current function is completed.is not correct, callbacks are often executed immediately. (even with thePromiseconstructor) Event listeners are called synchronously after the event as well IIRC