Skip to content

Conversation

@fuxingZhang
Copy link
Contributor

Fix not emit removeListener when type of eventName is 'symbol'

const EventEmitter = require('events');
const myEmitter = new EventEmitter();
const sym = Symbol('symbol');
const fn = () => { };
myEmitter.on(sym, fn);

myEmitter.on('removeListener', (...args) => {
  console.log('removeListener');
  console.log(args, args[0] === sym, args[1] === fn);
});

myEmitter.removeAllListeners()
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

Fix not emit removeListener  when type of eventName is 'symbol'

```js
const EventEmitter = require('events');
const myEmitter = new EventEmitter();
const sym = Symbol('symbol');
const fn = () => { };
myEmitter.on(sym, fn);

myEmitter.on('removeListener', (...args) => {
  console.log('removeListener');
  console.log(args, args[0] === sym, args[1] === fn);
});

myEmitter.removeAllListeners()
```
@nodejs-github-bot nodejs-github-bot added the events Issues and PRs related to the events subsystem / EventEmitter. label Feb 18, 2020
@addaleax
Copy link
Member

Superseded by #31847

@fuxingZhang Just for the future, you can always push new commits to a PR to make changes that you like instead of opening a new PR :)

@fuxingZhang
Copy link
Contributor Author

Superseded by #31847

@fuxingZhang Just for the future, you can always push new commits to a PR to make changes that you like instead of opening a new PR :)

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

events Issues and PRs related to the events subsystem / EventEmitter.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants