one confusing thing for newbies like me:
exports.get_list = function ( cb) {
rclient.smembers("list", function(err, members) {
members.forEach(function(member){
console.log(member)
})
cb(null, 'lst')
})
}
the function(member) for 'forEach' is callback, right? then why,
cb(null,'lst') will wait until the loop is over?
On Mar 20, 5:18 pm, Oliver Leics <[email protected]> wrote:
> On Tue, Mar 20, 2012 at 8:47 AM, Bruno Jouhier <[email protected]> wrote:
>
> > var next_id = rclient.incr("next_id", _);
>
> > This code is asynchronous. And the underscore marker indicates where the
> > code may yield. So nothing's hidden and the execution model is the same as
> > with async callbacks: non blocking, single threaded event loop, non
> > preemptive.
>
> The underscore "_" in the above example IS the callback, so it is
> still using callbacks. It is only abstracting them away.
--
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