We can use the web worker in HTML5 like this:
var worker = new Worker(\'worker.js\');
but why can\'t we call a function like this?
Just use my tiny plugin https://github.com/zevero/worker-create
and do
var worker_url = Worker.create(function(e){ self.postMessage('Example post from Worker'); //your code here }); var worker = new Worker(worker_url);