keyes
v1.1.0
Published
A tiny package for intercepting keypresses and firing callbacks.
Downloads
2
Readme
keyes
A tiny package for intercepting keypresses and firing callbacks.
Install
$ yarn add keyes
Usage
keyes
takes one or more Keys, consisting of a
Key Value and an
optional map of keyboard modifiers.
import keyes from 'keyes';
import fireToast from './fireToast';
window.addEventListener(
'keydown',
keyes(
[
{
value: 'c',
modifiers: { metaKey: true },
},
{
value: 'c',
modifiers: { ctrlKey: true },
},
],
fireToast,
),
);
API
Modifiers
The following modifier keys are available.