dimanche 23 décembre 2018

404 Not found while instantiating web worker in backbone.jsI

I was trying to implement web worker in a backbone.js project and I got the error message src/js/worker.js 404 (Not Found)

I created a worker.js file and I have the code below in the file

this.addEventListner('message', function(e){
console.log('Message received: ', e.data);

});

And the below code sends message to the worker

let worker = new Worker('src/js/worker.js')
worker.postMessage('hello');

Can someone please let me know what I'm doing wrong? Thanks!




Aucun commentaire:

Enregistrer un commentaire