Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.3k
Open
Labels
eventsIssues and PRs related to the events subsystem / EventEmitter.Issues and PRs related to the events subsystem / EventEmitter.
Description
- Version: v15.4.0
- Platform: MacOS V10.15.7
- Subsystem: lib/events.js
What steps will reproduce the bug?
constEventEmitter=require('events');constee=newEventEmitter();// const symbol = Symbol('listener');constsymbol='listener';constfn2=function(...args){console.log('Call fn2', ...args)};constfn=function(...args){console.log('Call fn', ...args);};fn[symbol]=fn2;ee.on('one',fn2)ee.on('one',fn);ee.emit('one');// Prints: // Call fn2// Call fnconsole.log('1. remove fn2')ee.removeListener('one',fn2);// fn is removed, expect remove the fn2 ee.emit('one');// Prints: // Call fn2console.log('2. remove fn2 again')ee.removeListener('one',fn2)// fn2 is removedee.emit('one')// Prints: // Call fn2console.log('3. remove fn2 again');ee.emit('one')How often does it reproduce? Is there a required condition?
Occurs every time.
What is the expected behavior?
Callfn2Callfn1.removefn2Callfn2.removefn2againCallfn3.removefn2againCallfnWhat do you see instead?
Callfn2Callfn1.removefn2Callfn22.removefn2again3.removefn2againAdditional information
Replace the listener attribute of event listener with symbol
Metadata
Metadata
Assignees
Labels
eventsIssues and PRs related to the events subsystem / EventEmitter.Issues and PRs related to the events subsystem / EventEmitter.