Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

164
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda