I have code with Worker in JavaScript
var worker = new Worker("indexWorker.js");
worker.addEventListener('message', function(e) {
oDefer.resolve();
}, false);
worker.postMessage({
"data": allData
});
return oDefer.promise;
How I can debug the indexWorker.js
?
I looked on the web and I saw that I need to do this in the Chrome the developer tool, however the option of the worker doesn't exist on Chrome that I can find.
Could you please advise me ?
The simplest way is to add
debugger;
To a line in your code. If dev tool is open, it will stop the code and open the debugger. See http://jsfiddle.net/mendesjuan/YUKSu/82/
You can add debugger
to the file that is running as a webworker (indexWorker.js
) or to the code responding to its messages.