Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug shared webworkers?

I am using shared webworkers, I am not getting the errors from the worker. The worker error handler not returning any errors!. How can I Debug shared webworkers.

var worker = new SharedWorker('Vult_worker.js');
    worker.port.start();
    worker.port.onerror = function(e) {
        consloe.log('ERROR: Line ', e.lineno, ' in ', e.filename, ': ', e.message);
    }

    worker.port.onmessage = function(e) {
        console.log(e.data);
    };
worker.port.postmessage();

worker Code:

onconnect = function(e) {
    var self = e.ports[0];
self.onmessage=function(){
self.postmessage(1/x);
}
like image 860
kongaraju Avatar asked Jun 19 '12 13:06

kongaraju


1 Answers

Navigate to chrome://inspect/#workers and find the shared worker and click on "inspect". Then you can pull up the console for the SharedWorker.

like image 67
bruceceng Avatar answered Sep 22 '22 13:09

bruceceng