This question has already been answered:
- How to perform javascript delay? 2 answers
I write small userscript on js for online games, small automation of routine actions (bot). There was a need to make delays anywhere in the code after performing any action. For example, something like delay () in Delphi, Pascal .. Stops program execution for the number of milliseconds specified in the parameter (1000 milliseconds in 1 second).
MB someone faced with a similar task mb wrote a similar delay function. setTimeout and setInterval are not suitable as they are heavily cluttering up the code if you constantly insert them and start to get confused with time, but the delay () function anywhere in the code would be perfect. Are there any third-party libraries for solving such problems?