How to avoid the Unresponsive Script popup in Firefox with long running Javascript?

后端 未结 5 883
心在旅途
心在旅途 2021-01-02 05:18

I want to benchmark some Javascript code in the browser, but it may trigger Firefox\'s \"Warning: Unresponsive script\" popup. This allows the user to click \"Stop script\"

5条回答
  •  温柔的废话
    2021-01-02 05:23

    You have to break up long actions into smaller ones and perform them in turns. This will also allow a better progress indication.

    http://www.sonofsofaman.com/hobbies/code/settimeout.asp

提交回复
热议问题