387429 (1) [Avatar] Offline
I have a question on event queue, which is covered in Chapters 2 and 13: Suppose I have the following code:
var url = ...; // whatever url
var xhr = new XMLHttpRequest();
xhr.open('get', url, async);

// line 6: Code that will take a long time ...

function callback() { 
  // ... 
xhr.addEventListener('load', callback);
xhr.addEventListener('error', callback);

If the code on line 6 will be done after the xhr request is done, will xhr's "load" and "error" events still be put into the event queue? Or these two events won't get into the queue at all because they don't have any event handlers attached to them (yet)?

Thank you very much for your help!