eventemitter.on()

emitter.on(eventName, listener)

Adds the listener function to the end of the listeners array for the event named eventName. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of eventName and listener will result in the listener being added, and called, multiple times.

server.on('connection', (stream) => {
  console.log('someone connected!');
});

Returns a reference to the EventEmitter so calls can be chained.

doc_Nodejs
2016-04-30 04:39:28
Comments
Leave a Comment

Please login to continue.