mirror of https://github.com/nodejs/node.git
Added documentation of EventEmitter.once
parent
a313f38c34
commit
179a7f6ffa
|
@ -244,6 +244,15 @@ Adds a listener to the end of the listeners array for the specified event.
|
|||
console.log('someone connected!');
|
||||
});
|
||||
|
||||
### emitter.once(event, listener)
|
||||
|
||||
Adds a **one time** listener for the event. The listener is
|
||||
invoked only the first time the event is fired, after which
|
||||
it is removed.
|
||||
|
||||
server.once('connection', function (stream) {
|
||||
console.log('Ah, we have our first user!');
|
||||
});
|
||||
|
||||
### emitter.removeListener(event, listener)
|
||||
|
||||
|
|
Loading…
Reference in New Issue