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

149
Views
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
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!