Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: Backport ee.once doc clarifications to 4.x. #7103

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions doc/api/events.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ myEmitter.emit('event');
```

Using the `eventEmitter.once()` method, it is possible to register a listener
that is immediately unregistered after it is called.
that is unregistered before it is called.

```js
const myEmitter = new MyEmitter();
Expand Down Expand Up @@ -338,9 +338,8 @@ Returns a reference to the `EventEmitter` so calls can be chained.

### 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.
Adds a **one time** `listener` function for the event named `eventName`. The
next time `eventName` is triggered, this listener is removed and then invoked.

```js
server.once('connection', (stream) => {
Expand Down