jaywcjlove / hotkeys-js

➷ A robust Javascript library for capturing keyboard input. It has no dependencies.
https://jaywcjlove.github.io/hotkeys-js
MIT License
6.61k stars 406 forks source link

怎么监听同时按下的键?我想录制快捷键。 #436

Closed Jarvie789 closed 1 year ago

Jarvie789 commented 1 year ago

如题

jaywcjlove commented 1 year ago
image

@Jarvie789 回调函数返回一个记录,可以使用 hotkeysEvent.keys, 需要更新到 v3.11.0,

hotkeys('*', (evn, hotkeysEvent) => {
  console.log('heven', hotkeysEvent);
  console.log('keys', hotkeysEvent.keys);
})
Jarvie789 commented 1 year ago
image

@Jarvie789 回调函数返回一个记录,可以使用 hotkeysEvent.keys, 需要更新到 v3.11.0,

hotkeys('*', (evn, hotkeysEvent) => {
  console.log('heven', hotkeysEvent);
  console.log('keys', hotkeysEvent.keys);
})

感谢老哥!