Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Remove .once events using removeListener #806

Closed
wants to merge 3 commits into from
Closed

Remove .once events using removeListener #806

wants to merge 3 commits into from

Conversation

3rd-Eden
Copy link

Howdy,

When you add a new once listener on a EventEmitter, it gets wrapped in a closure and pushed in the events hash. When this is done, you will lose the reference to the original listener and lose the abilities to remove the same listener again as the removeListener checks if the supplied functions are matching..

This patch will allow us to remove the attached once listeners again, because closure function will now have a reference attached to him where we can check on.

@ry
Copy link

ry commented Mar 22, 2011

can you add a test demonstrating this?

@3rd-Eden
Copy link
Author

Merged with upstream, and updated the test/simple/test-event-emitter-once.js testcase with a demonstration.

@3rd-Eden
Copy link
Author

Added support for removing .once listeners

Closed by 53bec1c.

@ry ry closed this Mar 25, 2011
@ry
Copy link

ry commented Mar 25, 2011

Thank you

coolaj86 pushed a commit that referenced this pull request Apr 15, 2011
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants