Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determine if javascript has completed

Tags:

javascript

My question is somewhat similar to this one. We want to know if there's a way to determine if all javascript has completed (so no javascript is running). We have a lot of stuff that runs on a timeout after the page's onload event, so even after the page is loading, stuff could be happening for a few seconds. For a whole bunch of reasons, mostly relating to requirements from management, we need to know when all of these scripts have finished running. There's an arbitrary number of them so a general solution would be great.

like image 686
Anthony Avatar asked Dec 14 '25 09:12

Anthony


1 Answers

The quickest and easiest was I can think of is to create a series of boolean values that tell you which processes have finished. After a method finishes, have it set one of the variables to true. When they are all true, you know that it's finished loading.

like image 124
kemiller2002 Avatar answered Dec 17 '25 01:12

kemiller2002



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!