Class KeycodeLayout

A concrete implementation of IKeyboardLayout based on keycodes.

The keyCode property of a 'keydown' event is a browser and OS specific representation of the physical key (not character) which was pressed on a keyboard. While not the most convenient API, it is currently the only one which works reliably on all browsers.

This class accepts a user-defined mapping of keycode to key, which allows for reliable shortcuts tailored to the user's system.


  • KeycodeLayout




_codes: CodeMap
_keys: KeySet
_modifierKeys: KeySet
name: string

The human readable name of the layout.


  • Test whether the given key is a valid value for the layout.


    • key: string

      The user provided key to test for validity.

    Returns boolean

    true if the key is valid, false otherwise.

Generated using TypeDoc