Click.js will detect mouse and keyboard events using a tiny child process and allow you to subscribe to the event loop using Node. It also detects switching between windows and changes made to the clipboard. (Click.js is Windows only)
First an example
Easy as pie!
var clickjs = var click = click clickstart
Require
var clickjs =
Create
var click =
Methods
A clickjs object exists of three methods.
- start()
- done()
- on()
Start
Start listening.
clickstart
Done
Kill the child.
click
On
Subscribe to events.
click
Types
There are 5 event types with consistent properties.
- keyInput (a key is pressed or released)
- mouseInput (any mouse button is pressed or released)
- clipboardModified (windows clipboard has been overwritten)
- applicationWindowChange (user changed active window)
keyInput
A key on the keyboard is pressed or released.
mouseInput
A mousebutton contains the event (sub)type as well as the coordinates.
clipboardModified
In most cases the user has pressed ctrl+c.
applicationWindowChange
A window is minimized or whatever.
Event loop
Subscribe to events using simple on-method.
mouseInput
Subscribe to all mouse events. Mouse events include button down, button up, scrolling and cursor movement.
click
Subscribe to other events
Subscribe to any of the 5 event types and console.log the event to see what info that gives you.
Subscribe to all available event types
This will not override the behavior of type specific callbacks but they will both be called.
click
Jochem Stoel
Involuntary public figure.
- https://www.npmjs.com/~jochemstoel
- http://jochemstoel.github.io/
- https://jochemstoel.tumblr.com/
- https://jochemstoel.nl/
- https://www.facebook.com/Jochem-Stoel-271292656217087/
- https://www.quora.com/profile/Jochem-Stoel