javascript worker loop ajax

时间:2015-05-08 09:55:22

标签: javascript web-worker

I am having a worker which has an array of urls. I loop through these URLs and throw an AJAX call, but inside success method of ajax when I send message back to website, it always sends the last request.

app.js

PrintDialog

worker.js

PrinterSettings.PrintRange = PrintRange.SomePages

Now inside var worker = new Worker('worker.js'); var urls = ['url1','url2','url3']; worker.addEventListener('message', function(e) { console.log('Worker: ', e.data.url); }, false); worker.postMessage({"args":[urls]}); of app.js, the output is only of the last url.

I don't get all all URLs response.

Can anyone help ?

0 个答案:

没有答案