-
Notifications
You must be signed in to change notification settings - Fork 315
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
refactor!(global-shortcut): better APIs DX #969
Conversation
GlobalShortcutExt::register_with_handler
Co-authored-by: Simon Hyll <hyllsimon@gmail.com>
Do we reall need the without_handler variants? can't users just define an empty closure and then the global listener handles the event? |
I am not happy with it either, the idea is to provide a method to register a shortcut without handler that is appealing to use, without using an empty closure, but a long method name is not good either, maybe just call it |
maybe that's even a non breaking change I believe |
I am afraid that might confuse users because |
Changed to take an |
that's what the on_ here will do: fn on_shortcut(&self, shortcut: &str, handler: impl Fn()) {}
fn register(&self, shortcut: &str) {} |
maybe I am overthinking it, let's roll with that and see user feedback |
hmm if we go with that approach, there will be inconsistencies between the JS and Rust APIs |
it's already inconsistent though 😂 JS is just different.. right now i wish we had function overloading in rust :D |
Alright, added that along with a few methods on the |
ref: #965