node-tutorial icon indicating copy to clipboard operation
node-tutorial copied to clipboard

node的iohook库

Open Wscats opened this issue 6 years ago • 1 comments

监听全局键盘

'use strict';
const ioHook = require('iohook');
ioHook.on('keydown', event => {
  console.log(event); // { type: 'mousemove', x: 700, y: 400 }
});
// Register and start hook
ioHook.start();
// Alternatively, pass true to start in DEBUG mode.
ioHook.start(true);

监听全局鼠标

'use strict';
const ioHook = require('iohook');
ioHook.on('mousemove', event => {
  console.log(event); // { type: 'mousemove', x: 700, y: 400 }
});
// Register and start hook
ioHook.start();
// Alternatively, pass true to start in DEBUG mode.
ioHook.start(true);

Wscats avatar Oct 16 '19 11:10 Wscats

使用ioHooK模块来监听onkeydown和onmousemove这两个事件

Heathy avatar Nov 13 '19 14:11 Heathy