The shortest way to check multi-times keydown
MIT License
The shortest way to check multi-times keydown
Inspired by is-hotkey
npm install is-hotkey-combine
# or use yarn
yarn add is-hotkey-combine
import isHotkeyCombine from 'is-hotkey-combine'
document.addEventListener('keydown', evt => {
if (isHotkeyCombine('shift*2', evt /*, options */)) {
// trigger when pressing `shift` twice
}
if (isHotkeyCombine('shift+a->b', evt /*, options */)) {
// trigger when pressing `shift+a` and `b` quickly
}
if (isHotkeyCombine(['shift+a', 'b'], evt /*, options */)) {
// trigger when pressing `shift+a` and `b` quickly
}
})
isHotkeyCombine(hotKey: string|string[], event: Event, options): boolean
duration
The duration about nearby trigger.
number
250
byKey
Extends from is-hotkey
git checkout -b feature-new
or git checkout -b fix-which-bug
git commit -am 'feat: some description (close #123)'
or git commit -am 'fix: some description (fix #123)'
git push
This library is written and maintained by imcuttle, [email protected].
MIT - imcuttle 🐟