Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best XHR solution, for use with workers?

(If there is a question which answers this, please let me know)

I'm looking for suggestions for cross-browser XHR support, with-in workers.

In the normal VM, I usually use jQ for XHR stuff. It seems like overkill to load jQ into a worker, just for the AJAX support (assuming that's doable; haven't tried).

Suggestions?

like image 259
Spot Avatar asked Jan 24 '26 10:01

Spot


1 Answers

I don't think there would be much point in firing a XML HTTP request from a web worker. After all, these requests are meant to be asynchronous! :)

Interestingly enough, someone suggested implementing support for XHR in web workers in the core of jQuery, but there's a very detailed response as to why it maybe isn't a good idea.

Some of his reasoning for why not to do it are:

  1. Spin up time for web workers is large
  2. Its not time efficient for single requests
  3. IE doesn't have very good support for web workers
  4. jQuery uses DOM methods throughout, meaning exceptions would be thrown when used in web workers

Quite a good read really

http://bugs.jquery.com/ticket/9889

Hope this helps!

like image 188
Andy Avatar answered Jan 25 '26 22:01

Andy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!