-
Notifications
You must be signed in to change notification settings - Fork 82
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
Tinykeys 2 #155
Comments
Thinking about ideas for the potential next version, it would be nice if developers can decide whether they want to have the shortcut key on all buttons/etc all the time, have it only until it is used for the first time (as soon as you hit |
@sassanh To do that reliably you'd need to store data server side |
Parts of it need a storage in the client side, we can let the user decide whether they want to store it in the cookies, the local storage or the server. In order to use those parts, users should provide the storage. It should be as simple as saving a string somewhere, and initializing it with that same string. The user needs to write something like this: tinykeys.initialize(JSON.parse(localStorage.getItem('myapp-tinykeys')));
tinykeys.onChange((state) => {
localStorage.setItem('myapp-tinykeys', JSON.stringify(state));
}) |
Or one may store it in server as you suggested: tinykeys.initialize(JSON.parse(await fetch('x.com/tinykeys-state', {headers: {oauthToken}})));
tinykeys.onChange(_.debounce((state) => {
fetch('x.com/tinykeys-state', {body: JSON.stringify(state), headers: {oauthToken}});
}, 1000)) |
Opening this to track some thoughts about a potential next version of this package
Specifically I want to push developers to make more accessible keyboard shortcuts.
I'm certain there are edge cases to this, but I think you should have to opt-out of these requirements.
Draft API
In React terms, it would look something like this:
Save Ctrl+S
I don't want to make this library very React specific though.
The text was updated successfully, but these errors were encountered: