Repository navigation
refactor!(global-shortcut): better APIs DX - #969
Conversation
GlobalShortcutExt::register_with_handlerCo-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