keycode.js
TypeScript icon, indicating that this package has built-in type declarations

2.0.0-alpha.3 • Public • Published

keycode.js

Use constants instead of plain number/string values for your keyboard bindings.

Codes extracted from KeyboardEvent.code.

1.7kb minified

Usage example

import { Keycode } from "keycode.js";
 
document.addEventListener('keyup', function(e) {
  if (e.code == Keycode.Enter) {
    console.log("User pressed ENTER key")
  }
})

License

MIT

/keycode.js/

    Package Sidebar

    Install

    npm i keycode.js

    Weekly Downloads

    294

    Version

    2.0.0-alpha.3

    License

    MIT

    Last publish

    Collaborators

    • endel