Determine if javascript is complete

My question is somewhat similar to this one. We want to know if there is a way to determine if all javascript is complete (so javascript is not working). We have many things that time out after a page load event, so even after the page loads, the material can happen within a few seconds. For a variety of reasons, mainly related to management requirements, we need to know when all of these scenarios are completed. There were an arbitrary number of them, so a general solution would be wonderful.

+3
source share
4 answers

The fastest and easiest I can think of is to create a series of logical values ​​that will tell you which processes have been completed. At the end of the method, set one of the variables to true. When all of them are correct, you know that you have finished downloading.

+2
source

You can create a function excuteWithNotify(functionToEexcute). It will get the function to execute as a parameter, execute it, and then set the flags accordingly.

+2
source

JS . boolean .

+1

, imDone(), .

0

Source: https://habr.com/ru/post/1748778/


All Articles