How to debug web workers

前端 未结 12 1119
被撕碎了的回忆
被撕碎了的回忆 2020-12-05 09:02

I have been working with web workers in HTML 5 and am looking for ways to debug them. Ideally something like the firebug or chrome debuggers. Does anyone have any good solu

12条回答
  •  攒了一身酷
    2020-12-05 10:03

    As in Chrome v35

    • Load your page and open Chrome Developer Tools.

    • Navigate to Sources tab.

    • Check Pause of Start check-box, as shown below:

      Debugging workers in Chrome Dev Tools

    • Reload the page, the debugger will pause in the web worker, though in a new window!

    Edit: in newer versions of Chrome (I'm using v39), the workers are under a "Threads" tab instead of having their own "Workers" tab (The Threads tab will become visible if there are any running workers).

提交回复
热议问题