I made a function that takes a number of asynchronous data-retrieval-functions and calls a callback when all functions return their data.
I’m wrestling with the terminology though. I’ve found similar examples here on StackOverflow but none of them offer anything in the way of solid terminology.
Resources that illustrate the functionality:
- Parallel asynchronous Ajax requests using jQuery
- Javascript – synchronizing after asynchronous calls
- Synchronizing event-based plugin calls in JavaScript
Related terminology: fork, wait, synchronize, semaphore.
What is a good name for this function?
For the sake of being complete. There isn’t really a good word for it (yet). But frameworks like jQuery and commonJS have adopted a
deferredAPI that allows you to make eventual promises about asynchronous requests. This is what I’ll be using.You can find more info when you look at the documentation of the mentioned frameworks but it’s roughly like this:
The
then-clause will fire when all requests have returned successfully.You’ll probably want to do something with error handling and manually fulfilling (or rejecting) promises but this is beyond the scope of my question.