Skip to content Skip to sidebar Skip to footer

Structure Of Async Callbacks In Javascript: Synching The Asynch

I find the seperation of code between when using callbacks makes my code harder to understand and maintain. How do you handle the problem? Here are a couple of solutions I have com

Solution 1:

With newer versions of jquery every thing is changing regarding callbacks.

http://addyosmani.com/blog/jquery-1-7s-callbacks-feature-demystified/

Solution 2:

Async callbacks are something you will just have to deal with in web programming. I think its just a case of getting into the mindset that something will be called eventually.

I don't tend to see code in real life like your 2nd example so I'd be wary of this approach. You first approach is more like the way to go but it looks a little old school to me.

As I seem to be in the habbit of giving you links rather than answering your question as fully as I like. I'll refer you to deffered objects. I personally find them at least initally even less readible but when you get them you wont be able to understand how you did without.

What are deferred objects?

Post a Comment for "Structure Of Async Callbacks In Javascript: Synching The Asynch"