最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to stop all the scripts in a page in javascript? - Stack Overflow

programmeradmin0浏览0评论

I am struggling with the fact that the flow of control in javascript is not what I'm used to. Not linear. Sometimes when I test I get the error message "A script is slowing down your browser" at times when everything should be stopped.

I spend ages looking for the bug. This time it was something really silly, a variable which stopped the function when it reached 350 px. Then I added a way to change the speed and sometimes this variable was incremented by 3 at each step. So it never reached 350, it went from 348 to 351.

So I was wondering if there was a "STOP!" mand. Something which would leave the display of the web page in its current state but stop all running processes?

I am struggling with the fact that the flow of control in javascript is not what I'm used to. Not linear. Sometimes when I test I get the error message "A script is slowing down your browser" at times when everything should be stopped.

I spend ages looking for the bug. This time it was something really silly, a variable which stopped the function when it reached 350 px. Then I added a way to change the speed and sometimes this variable was incremented by 3 at each step. So it never reached 350, it went from 348 to 351.

So I was wondering if there was a "STOP!" mand. Something which would leave the display of the web page in its current state but stop all running processes?

Share Improve this question asked Apr 1, 2021 at 15:58 Alain ReveAlain Reve 3211 gold badge2 silver badges15 bronze badges 2
  • 3 The answer is: No – epascarello Commented Apr 1, 2021 at 16:02
  • 1 you should fix the logic, there is nothing prevent you from return – apple apple Commented Apr 1, 2021 at 16:15
Add a ment  | 

2 Answers 2

Reset to default 7

Debugger? It just creates a breakpoint, where you can analyse what's going on right now. I know it's not exactly what you're asking about, but it could work for your use case.


Usage

debugger;

发布评论

评论列表(0)

  1. 暂无评论