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

150
Visualizações
How do browsers handle DOM events during blocking operations?

For instance, we have function reallyHeavyOperation, that blocks javascript thread for some time. And, during this operation execution, user clicks a button with a listener attached to it.

For the code below, Chrome logs "click" after reallyHeavyOperation is finished.

test.addEventListener('click', () => {
  console.log('click')
})
reallyHeavyOperation();

As I know, browsers handle such DOM events synchroniously(please tell me if I'm mistaken). But how can they do it, when execution thread is blocked with some work? Is there something like UI events queue, where browsers store interactions and then dispatch them, when the call stack becomes free?

I would really appreciate if someone could give links to specifications or source code, so that I could read more about this!

about 4 years ago · Juan Pablo Isaza
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