-
-
Notifications
You must be signed in to change notification settings - Fork 33k
Closed
Labels
docIssues and PRs related to the documentations.Issues and PRs related to the documentations.eventsIssues and PRs related to the events subsystem / EventEmitter.Issues and PRs related to the events subsystem / EventEmitter.
Description
- Version: v4.3.2
- Platform: Linux osmith-ubuntu-t1700 4.2.0-30-generic docs: re-word project messaging #36-Ubuntu SMP Fri Feb 26 00:58:07 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
- Subsystem: events, docs
Documentation describes ee.once()
behaviour as (emphasis mine)
Adds a one time listener function for the event. This listener is invoked only the next time event is triggered, after which it is removed.
The actual current behaviour is for the listener to removed, and then invoked.
'use strict';
const assert = require('assert');
const EventEmitter = require('events');
const order = [];
new EventEmitter()
.on('removeListener', () => order.push('remove'))
.once('foo', () => order.push('invoke'))
.emit('foo');
process.on('exit', () => assert.deepEqual(order, ['invoke', 'remove']));
assert.js:89
throw new assert.AssertionError({
^
AssertionError: [ 'remove', 'invoke' ] deepEqual [ 'invoke', 'remove' ]
at process.<anonymous> (/home/omsmith/ee-once-remove-order-test/index.js:13:33)
at emitOne (events.js:77:13)
at process.emit (events.js:169:7)
Metadata
Metadata
Assignees
Labels
docIssues and PRs related to the documentations.Issues and PRs related to the documentations.eventsIssues and PRs related to the events subsystem / EventEmitter.Issues and PRs related to the events subsystem / EventEmitter.