+1 to this.

On Sun, Apr 8, 2012 at 8:16 PM, mscdex <[email protected]> wrote:

> On Apr 8, 10:57 pm, Matthew Hazlett <[email protected]> wrote:
> > It works but its still calllback hell :-(  The db connection gets reused
> > tho.
>
> FWIW I do two things in my apps when it comes to deeply nested
> callbacks:
>
> 1. Pull out some or most of the anonymous functions/callbacks, change
> them to named functions, place them outside of the current function
> scope (I usually put them in the global/module-level scope), and use
> those named functions instead.
>
> 2. Use async.js for anything that can't be easily handled/abstracted
> by #1: `npm install async` or: https://github.com/caolan/async. It
> doesn't use fibers, coroutines, threads, etc, just plain helper
> functions to perform asynchronous tasks in a more organized fashion.
>
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>



-- 
-- 
Marak Squires
Co-founder and Chief Evangelist
Nodejitsu, Inc.
[email protected]

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to