Check out a free preview of the full Exploring Service Workers course

The "Web Workers Q&A" Lesson is part of the full, Exploring Service Workers course featured in this preview video. Here's what you'd learn in this lesson:

Kyle fields questions about browser choice and debugging web workers in the developer tools console.

Preview
Close

Transcript from the "Web Workers Q&A" Lesson

[00:00:00]
>> Kyle Simpson: What questions can we answer about dedicated woodworkers?
>> Student: This is actually a housekeeping, boring one. But, so we're gonna be using DevTools a fair bit. Should we be mostly working in Chrome, henceforth, or is it
>> Kyle Simpson: For this, the purposes of this workshop, we're gonna work exclusively in Chrome.

[00:00:19]
I'm hoping that you will find the code that we write would be agnostic to the browser. But there certainly can be little quacks where you try it in firefox and things don't run in exactly the same order usually, it's not that stuff is totally broken. But it may happen in different order.

[00:00:36]
But yeah, we're gonna be working entirely in chrome. I mean the latest version of chrome. So let me see what that version is at this moment. Let's do about Chrome.
>> Kyle Simpson: Yeah, I'm in 74, so
>> Student2: It's a small aside here. I just tried it in Internet Explorer and it is completely broken.

[00:01:00]
>> Kyle Simpson: Is it?
>> Student2: Yeah.
>> Kyle Simpson: In IE?
>> Student2: Yeah.
>> Kyle Simpson: Which version of IE?
>> Student2: 11.
>> Kyle Simpson: 11, I would have expected it to work in 11. Interesting.
>> Student3: Is it possible to ebug Webworkers and Devtools in the normal, usual way and the depth?
>> Kyle Simpson: Yeah, absolutely it is.

[00:01:16]
So you saw that we were able to receive a console log message from there. But if there is a web worker running, it'll be listed here. So let's try that. Let's click Start, and then our worker is here, so now we're filtering only messages from the worker. Debugging works exactly the same with watch expressions and exceptions that happen, pause on exceptions.

[00:01:40]
You can click in the Sources tab and get your worker right here and then access it and open it up.
>> Kyle Simpson: That's interesting, I don't know why it didn't show it. That looks like a Chrome bug. It's not rendering it. But yes, the answer is you can do full debugging of your workers while they're running on the page.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now