> What would be the most elegant way to do this? I had the idea to store 
> the functions in a list and call them one after the other in a loop.
> 
> The other idea I had is this:
> 
> var myCallback;
> function initialize(callback) {
>      if (myCallback) {
>          myCallback = function() {
>              myCallback();
>              callback();
>          }
>      } else {
>          myCallback = callback;
>      }
> }
> 
> Hm, that doesn't convince me either. Both ideas make me think there is a 
> more elegant way to achieve this. Is there a better pattern from the 
> gurus out there?

Check out the queuing used by the test suite. It stores the callbacks in an 
array and normally executes them immediatly. But if one choose to block the 
queue, it stops executing and must be resumed later.

It's basically no more then a more advanced "store the functions in a list and 
call them one after the other in a loop", but maybe it's just what you need.

Regards
Jörn
-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to