Skip to content

Commit 179a7f6

Browse files
nikhilmry
authored andcommitted
Added documentation of EventEmitter.once
1 parent a313f38 commit 179a7f6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

doc/api.markdown

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,15 @@ Adds a listener to the end of the listeners array for the specified event.
244244
console.log('someone connected!');
245245
});
246246

247+
### emitter.once(event, listener)
248+
249+
Adds a **one time** listener for the event. The listener is
250+
invoked only the first time the event is fired, after which
251+
it is removed.
252+
253+
server.once('connection', function (stream) {
254+
console.log('Ah, we have our first user!');
255+
});
247256

248257
### emitter.removeListener(event, listener)
249258

0 commit comments

Comments
 (0)