1

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:

Related terminology: fork, wait, synchronize, semaphore.

What is a good name for this function?

Community
  • 1
  • 1
Halcyon
  • 57,230
  • 10
  • 89
  • 128
  • 1
    Deferreds. You are using the jQuery 1.5 deferred objects right? It's simply `$.when`. [Futures](https://github.com/coolaj86/futures) refers to this as a join. – Raynos Jun 23 '11 at 16:32
  • I'm not using jQuery but I guess my function is similar to a `$.when([multiple]).then()` structure. I'll look into it. Thanks! – Halcyon Jun 23 '11 at 18:57
  • @FritsvanCampen Ah in that case look at commonJS for word choice. – Raynos Jun 23 '11 at 21:53
  • The commonJS API looks very similar to the jQuery API. http://waterken.sourceforge.net/web_send/#API – Halcyon Jun 24 '11 at 13:44
  • I meant [CommonJS](http://wiki.commonjs.org/wiki/CommonJS) – Raynos Jun 24 '11 at 13:45
  • When you follow the trail of the API definition that's where it takes you .. – Halcyon Jun 24 '11 at 14:38

2 Answers2

0

How about "waitAll"? It's succinct, but it still gets the point across about what it does.

FishBasketGordo
  • 22,904
  • 4
  • 58
  • 91
  • Thank you for your answer. It doesn't just wait. The functions are very specifically data retrieving functions. – Halcyon Jun 23 '11 at 18:49
0

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 deferred API 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:

FW.when([asynchrnous_request, ... ]).then(do_something)

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.

Halcyon
  • 57,230
  • 10
  • 89
  • 128