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: add @keyup and @keyupScoped decorators #32

Open
acusti opened this issue Sep 2, 2016 · 1 comment
Open

Feature request: add @keyup and @keyupScoped decorators #32

acusti opened this issue Sep 2, 2016 · 1 comment

Comments

@acusti
Copy link

acusti commented Sep 2, 2016

In my use case, I’d like to be able to toggle state based on if a modifier key is pressed, so it would be great to be able to do something like:

class MyComponent extends React.Component {

  @keydown('alt')
  setModeCopy(event) {
    this.setState({ mode: 'copy' });
  }

  @keyup('alt')
  setModeMove(event) {
    this.setState({ mode: 'move' });
  }
}

In actually use, I think I would use @keydownScoped and @keyupScoped.

@gbishop
Copy link

gbishop commented Sep 2, 2016

I could easily handle disabling key-repeat #30 with this feature.

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

No branches or pull requests

3 participants