SkillAgentSearch skills...

Keycode

Use human key names instead of keycode numbers for your keyboard bindings.

Install / Use

/learn @gamestdio/Keycode
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

@gamestdio/keycode

Use human key names instead of keycode numbers for your keyboard bindings.

1.7kb minified

Warning

The which and keyCode properties are in the process of being deprecated by the browsers.

After mainstream adoption, you would rather use the new key or code attributes in KeyboardEvent.

By the time of this writing, IE/Edge still doesn't support the new KeyboardEvent.key / KeyboardEvent.code API. See: https://caniuse.com/#feat=keyboardevent-code

Usage example

import * as Keycode from "@gamestdio/keycode";

document.addEventListener('keyup', function(e) {
  if (e.which == Keycode.ENTER) {
    console.log("User pressed ENTER key")
  }
})

License

MIT

View on GitHub
GitHub Stars22
CategoryDevelopment
Updated1y ago
Forks6

Languages

TypeScript

Security Score

75/100

Audited on Jan 31, 2025

No findings