I’m writing a script for the serial extraction of information from a page, in general I have to pause javascript, but that the page continues to load, and the javascript stopped.
setTimeout is not necessary, since the rest of the script is still running
I need it in order to make the script continues to run after the other script (which I do not have access) download the necessary data to the page (this takes 3 seconds).
P.S. If there is something I pull information from the village – http://www.mosgortrans.org/pass3/ using mozilla with extention “user script”
As the previous answer and comment have suggested, the normal way of doing this would be to put the code you want to run after the script loads in a function in
setTimeout. If you are worried, for instance, about event handlers being triggered while you are waiting and causing an error, then you need to disable the event handlers (e.g.element.onclick = null) then re-enable them within the time-out function. I suppose you could also do something like this:but this is messy because you have to include
if (pause) returnat the start of every function that you want to disable while the script is paused. Also you may or may not want to add extra code to run all those functions that were called while the script was paused, once it has been un-paused.