-
Notifications
You must be signed in to change notification settings - Fork 437
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: overwrite EventBus.off method to clear once events #13736
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a fun of adding a new function to unsubscribe from a listener. Unlisten shouldn't be different between on
and once
. It has the same semantics and job. Same for other Event Emitters, including native removeEventListener
.
Also, identifying a function by name is not reliable. It can be empty, it can be not unique.
Instead, let's store once
handlers in a Map<type, Map<originalHandler, onceHandlers>>
and override off
method to support new feature.
Signed-off-by: Maksim Sukharev <[email protected]>
Signed-off-by: Maksim Sukharev <[email protected]>
a13e2ca
to
1ca78af
Compare
Signed-off-by: Maksim Sukharev <[email protected]>
Signed-off-by: Maksim Sukharev <[email protected]>
Signed-off-by: Maksim Sukharev <[email protected]>
☑️ Resolves
🖌️ UI Checklist
🏁 Checklist