Debugging Web Workers

You can set breakpoints and interact with worker threads using the browser's development tools. In Google Chrome, open Developer Tools and select the Sources tab. The file list panel should contain two instances of worker.js. The debugger panel contains a Threads section with the main thread and two worker.js threads. The following screenshot indicates the thread debugging elements within the Chrome Developer Tools panel for the running application:

Thread debugging tools in the Chrome Developer Tools panel

In Firefox, worker debugging is done in separate Developer Tools windows. To see this in action, open Developer Tools in Firefox and select the Debugger panel. Click on one of the worker.js list items in the Workers panel. A new Developer Tools window should appear that corresponds with the selected worker. The following screenshot shows a separate Developer Tools window for one of the worker.js instances selected from the Workers panel:

Thread debugging tools in the Firefox Developer Tools panel

In the next section, we'll discuss some of the upcoming features of WebAssembly.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset