Skip to content

Commit

Permalink
Added documentation of EventEmitter.once
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilm authored and ry committed Oct 20, 2010
1 parent a313f38 commit 179a7f6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions doc/api.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 179a7f6

Please sign in to comment.