During the execution phase in javascript timeline, events occur which invokes registered event handlers asynchronously. As per my knowledge in asynchronous calls the program execution doesn't wait for the completion of a task instead it moves onto the next task. So can anyone explain how does javascript handle asynchronous execution of 2 event handler functions registered to a single event on its occurrence?
For eg:
window.addEventListener("load",function(){console.log("onload event 1 called!");},false);
window.addEventListener("load",function(){console.log("onload event 2 called!");},false);
Does javascript interpreter just invokes the first event handler and moves on to the second event handler and execution part of first event handler is performed by another thread?
And I have read that javascript follows single threaded model so how does that fit in?