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

171
Views
Event Listener when a browser finishes updating the DOM

There is a huge HTML table and JS code that sorts it.
I want to show some loading icon or an overlay when the sorting code is executed.
All works fine, but there is a time gap between end of code and the actual appearance of the updated table.
My guess it that it takes some time until the browser finishes redrawing the page.
I have tried using Observer, but it fires only after the DOM modification, there is still a delay before I can see the actual updated table.
Is there any JS event that happens after the browser finishes drawing the page?

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You can use the trigger to fire off events at the start and end of your processing.

If you're using jQuery it would look something like this:

function processTable(){
  $(document).trigger('startProcessing', {
    description: 'Enable Loader'
  });

... //Processing done here

  $(document).trigger('endProcessing', {
    description: 'Disable Loader'
  });
}


jQuery(document).on('startProcessing',enableLoaderFunction);
jQuery(document).on('endProcessing',disableLoaderFunction);

This can also be done in just JS by making sure that you use the proper event handler for the browser that is being used. Here is the documentation for handling without jQuery: https://developer.mozilla.org/en-US/docs/Web/Events/Creating_and_triggering_events

about 4 years ago · Santiago Trujillo 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!