uc-keys

1.0.0 • Public • Published

Unchained UI

Keys

NPM Version NPM Downloads

Hotkeys detection & defenition

ES module version of is-hotkey

Usage

import isHotkey from 'uc-keys';
 
function onKeyDown(e) {
  if (isHotkey('mod+s', e)) {
    ...
  }
}

For better perfomance you can curry the hotkey:

import isHotkey from 'uc-keys'
const isSaveHotkey = isHotkey('mod+s')
 
function onKeyDown(e) {
  if (isSaveHotkey(e)) {
    ...
  }
}

License MIT

© Ian Storm Taylor

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i uc-keys

      Weekly Downloads

      0

      Version

      1.0.0

      License

      MIT

      Unpacked Size

      6.34 kB

      Total Files

      6

      Last publish

      Collaborators

      • velocityzen