I am not really sure it is possible in JavaScript, so I thought I'd ask. :)
Say we have 100 requests to be done and want to speed things up.
What I was thinking of doing is:
- Create a loop that will launch the first 5 ajax calls
- Wait until they all return (success - call a function to update the dom / error) - not sure how, maybe with a global counter?
- Repeat until all requests are done.
Considering browser JavaScript does not support thread, can we "exploit" the async
functionality to do that?
Do you think it would work, or there are inherent problems doing that in JavaScript?