Reputation: 2057
I know that canvas tags or any other tag can't be created inside of a web worker, but the web worker can make ajax calls. Would it be more efficient when drawing images to create a web worker, have it do an ajax call to another file, that then generates a canvas and returns the data from "getImageData"?
Upvotes: 1
Views: 174
Reputation: 826
If you need to do some processing on the data (that you will receive from ajax call) then only you should use a web worker . For example if you have to calculate the average price of stocks over a week and then display it as a bar chart and you have data of complete year then you can use a web worker for this . Otherwise there is no point of using a web worker just to make a ajax call only to return that data again to ui thread.
Upvotes: 2