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

Fix removing multiple event listeners of the same type #374

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mladenilic
Copy link

@mladenilic mladenilic commented Nov 19, 2019

This PR implements or fixes...

Emitter#off fails to remove multiple event listeners of the same type. This PR also adds "removes multiple callbacks of event type" test case which demonstrates this issue.

The Array.filter() approach is slightly faster as well (at least on Chrome, but probably across the board):

splice – 100000 x 50 elements: 254.009765625ms
filter – 100000 x 50 elements: 53.3818359375ms
–––––––––––––––––––––
splice – 100000 x 100 elements: 502.173095703125ms
filter – 100000 x 100 elements: 72.447998046875ms
–––––––––––––––––––––
splice – 100000 x 150 elements: 707.951171875ms
filter – 100000 x 150 elements: 98.218994140625ms

Does this PR require the Docs to be updated?

No

Does this PR require new tests?

No

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant