Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

155
Views
the callback function of addEventListener is queued in macro task queue in Event Loop?

I know that the callback function of setTimeout, setInterval, setImmediate api is queued in macro task queue.

But, I'm not sure about addEventListener.

Is the callback function of addEventListener is queued in macro task queue?

Check please :D

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I know that the callback function of setTimeout, setInterval, setImmediate api is queued in macro task queue.

It's not. What is queued in the timer task-queue is a task. This task's steps will be responsible of executing the callbacks (through the fire an event algo). The callback itself is stored in memory.
For event listeners it's about the same, event callbacks are never queued in a task source, only tasks or microtasks are, and as part of these tasks's steps the events are dispatched and the callbacks are executed.

For instance you can very well have an event fire from a microtask (e.g the slotchange event, but you can also force it yourself with EventTarget#dispatchEvent()), most native events are generally part of task (just search for the phrase to fire an event in the HTML specs for examples), and you have loads of events that don't fire from any tasks nor microtask, but directly as part of the event loop processing, in the update the rendering step.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!