Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add ProvideHotkeysContextOptions #84

Open
mondeja opened this issue Mar 21, 2024 · 0 comments
Open

Add ProvideHotkeysContextOptions #84

mondeja opened this issue Mar 21, 2024 · 0 comments
Milestone

Comments

@mondeja
Copy link
Collaborator

mondeja commented Mar 21, 2024

I would like to write something like the next code to provide a global context for keyboard shortcuts:

provide_hotkeys_context(main_ref);

and provide the context with the default false and scopes!() parameters.

Implementation proposal

I think that the best approach is to use the same that leptos-use does (eg. see use_element_size and use_element_size_with_options) as this would reduce mental overhead when using libraries in the Leptos ecosystem.

  • provide_hotkeys_context would accept only a node ref.
  • Add a new function provide_hotkeys_context_with_options that would accept a new struct ProvideHotkeysContextOptions whose parameters can be defined using the builder pattern.

Of course, this is a breaking change that should be postponed for v0.3.0 or beyond that.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

1 participant