Skip to content
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

[Feature Request] Ability to switch back to previous scope #174

Open
TimothyIp opened this issue Dec 12, 2017 · 1 comment
Open

[Feature Request] Ability to switch back to previous scope #174

TimothyIp opened this issue Dec 12, 2017 · 1 comment

Comments

@TimothyIp
Copy link

Just want to be able to set scope back to previous one without setting a variable, and without knowing what the previous scope was. In my current application, I have many components where when a specific component is mounted I want it to use its scope and when that component dismounts -> back to previous scope [my component doesn't need to know the previous scope].

@phun-ky
Copy link

phun-ky commented Sep 13, 2018

Well, your app will know which component is mounted right? So just based on that, you can use the provided example:

// define shortcuts with a scope
key('o, enter', 'issues', function(){ /* do something */ });
key('o, enter', 'files', function(){ /* do something else */ });

// set the scope (only 'all' and 'issues' shortcuts will be honored)
key.setScope('issues'); // default scope is 'all'

// remove all events that are set in 'issues' scope
key.deleteScope('issues');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants