Q:

How Javascript event-driven works inside

If we want a callback while the user clicks a button, we just simply type
btn.addEventListener('click', callback) 
The question I want to figure out is this: how can it work? How to do that?
Did the browser add a thread that continued checking for it (that's obviously not the case, since it consumes lots of resources).
Or did the browser inside use some kind of server push-technology or something else?

A:

To simplify the description, let's just say the browser has a general "mouse click event" on it's whole application canvas, then figures out which element on the screen is at that position and fires the appropriate click event for that element.
Here's an article about WebKit internals that goes more in details on how browsers parse, DOM, events, etc...
Is that what you are looking for? What exactly are you trying to accomplish?
Hope this helps

