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

Added ability to be used using a switch statment (#46) #47

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

samyosm
Copy link

@samyosm samyosm commented Aug 23, 2022

Description

I added a toHotkeyName and a getHotKeyName function in order to convert an event to a hotkey name that can then be used inside a switch statement.

I also took the time to add the necessary documentation though it might not be fully complete as I didn't describe the toHotKeyName function.

Fixes #46

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • Documentation update

How To Verify?

If you would like, you could test this feature in this sandbox.

@ianstormtaylor
Copy link
Owner

@osmium-dev thank you, this is a really cool idea!

Can you add a few tests to ensure this stays working going forward? Thanks!

@aifrim
Copy link

aifrim commented Nov 10, 2022

I would love these, @samyosm can you please, also add the tests so that @ianstormtaylor can merge :)

if (hotkey.ctrlKey || hotkey.metaKey) name.push("mod");
if (hotkey.shiftKey) name.push("shift");
if (hotkey.altKey) name.push("alt");
name.push();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe name.push(hotkey.key)?

@samyosm
Copy link
Author

samyosm commented Nov 27, 2022

@osmium-dev thank you, this is a really cool idea!

Can you add a few tests to ensure this stays working going forward? Thanks!

I added a few tests, I'm not sure they pass thought.

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

Successfully merging this pull request may close these issues.

Adding possibility to use it using a switch statement
4 participants