Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

166
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda