Re: [nodejs] Does events gets executed sync'd or async'd?

2013-01-11 Thread Bradley Meck
If you need to break something off as to not interfere for w/e reason, look at `process.nextTick`, if you need to chain together a reaction to an event from async functions look at `async` from https://github.com/caolan/async or `understudy` from https://github.com/bmeck/understudy depending on

Re: [nodejs] Does events gets executed sync'd or async'd?

2013-01-11 Thread Eric Chaves
Hi Issac, Thanks for the explanation. It really makes a lot of sense when events are used in a more "interactive" way allowing an listener to modify the target. There was a case however for events when they are used just as a notification pump, to warn that something happened but without being ab

Re: [nodejs] Does events gets executed sync'd or async'd?

2013-01-11 Thread Isaac Schlueter
If you think about how events are used, it's really important that emit() is synchronous. If I do `foo.on('bar', myFunction)`, then I want myFunction to be called *right when 'bar' happens*, not some time *after* 'bar' has happened. This is especially important when you think about a http request

Re: [nodejs] Does events gets executed sync'd or async'd?

2013-01-11 Thread Eric Chaves
Thanks! 2013/1/11 Dan Milon > danmilon -- 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 n

Re: [nodejs] Does events gets executed sync'd or async'd?

2013-01-11 Thread Dan Milon
sync. https://github.com/joyent/node/blob/master/lib/events.js#L123 danmilon On 01/11/2013 06:21 PM, Eric wrote: > Hi guys, > > Newbie question here: when a code calls emitter.emit(event), does the > listeners get executed synchronously or asynchrounsly? > > Thanks for the help, > > Eric. > >

[nodejs] Does events gets executed sync'd or async'd?

2013-01-11 Thread Eric
Hi guys, Newbie question here: when a code calls emitter.emit(event), does the listeners get executed synchronously or asynchrounsly? Thanks for the help, Eric. -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You r