Questions 1: Are event listeners always invoked synchronously?

For example, If I do:

event.on("end", function() {
  console.log("end");
});
event.emit("end");
event.removeAllListeners();

Does this code always prints "end" every time?

Question 2: Are event listeners always invoked in the order of they are 
attached?

For example, if I do:

event.on('end', function() {
  console.log('end');
});
event.on('end', function() {
  event.removeAllListeners();
});
event.emit('end');

Does this code always prints "end" every time?

For all tests I ran, the answers to both of these questions are YES. But 
I'm not sure whether these are semantics I can rely on across difference 
versions of nodejs. Does nodejs provides these semantics guarantees, or are 
they implementation dependent?

Thanks,
Chaoran Yang

-- 
-- 
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 nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to