Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
25
rated 0 times [  32] [ 7]  / answers: 1 / hits: 46551  / 13 Years ago, fri, november 18, 2011, 12:00:00

I couldn't find this answer on Google because 'on' is such a common word.
In this node.js example:



conn.on('close', function() {
var pos = connections.indexOf(conn);
if (pos >= 0) {
connections.splice(pos, 1);
}
});


There is a .on method(?). What it does? It is a JavaScript method? Or it is something you only find in node? I'm kind of confused because I think I saw something like .on on jQuery. Is it similar to the jQuery .live event handler?



Can anyone explain this to me?


More From » node.js

 Answers
60
[#89032] Thursday, November 17, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
sylviakaitlinj

Total Points: 564
Total Questions: 114
Total Answers: 105

Location: Jordan
Member since Thu, Aug 11, 2022
2 Years ago
;