-
-
Notifications
You must be signed in to change notification settings - Fork 413
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
Make hotkeys events removable #90
Comments
@SylvainMarty Oh! I haven't used Vue.js yet, you can try to solve the lead to memory leaks issue. |
@SylvainMarty Just create an array and keep there all the keyboard events ;) |
@jaywcjlove thanks for the amazing library Any update on this? |
@SylvainMarty It can be handled in the following way. // define shortcuts with a scope
hotkeys('ctrl+o, ctrl+alt+enter', 'issues', function(){
console.log('do something');
});
hotkeys('o, enter', 'files', function(){
console.log('do something else');
});
// set the scope (only 'all' and 'issues' shortcuts will be honored)
hotkeys.setScope('issues'); // default scope is 'all' |
@yakov116 I think it may not be necessary. Can be achieved through scope. |
@jaywcjlove can you give a bit explaining how scope works? I read the readme and tried it in practice. |
@yakov116 Yes, there is only one |
@jaywcjlove ok. |
@yakov116 Welcome to improve the documentation. |
Thanks @jaywcjlove for the awesome lib! |
@jaywcjlove Thank you for all the explanation about scopes ! |
@SylvainMarty 👍 Looking forward to your PR. |
Hi!
We just started to use this library in our VueJS project, the shortcut system works great!
But we have an important downfall with this library in our single page app, we must remove subscribed events when there are not necessary anymore.
For this, it will be very helpful to have a method
destroy()
to unsubscribe all the event listeners added by the library.For now, we use the
unbind()
method but its not enough and the current behavior can lead to memory leaks.We can contribute with a PR but we wanted to see if there were any cons to add this method to the library.
I'm available if there's any question. 👍
The text was updated successfully, but these errors were encountered: