eventemitter.once()

emitter.once(eventName, listener)

Adds a one time listener function for the event named eventName. This listener is invoked only the next time eventName is triggered, after which it is removed.

server.once('connection', (stream) => {
  console.log('Ah, we have our first user!');
});

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

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

Please login to continue.