xoi
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

Xoi Travis CI Build Status

Detect and control the mouse, keyboard and screen.

NPM Badge

Install

npm install xoi

Usage

const { mouse, keyboard, screen } = require("xoi");
 
// Realistically move the mouse to x=100 y=100
mouse.move(100, 100, { smooth: true });
 
// Right-click
mouse.click("right");
 
// When mouse clicked
mouse.on("click", ({ button }) => {
    console.log(`The ${button} mouse button was clicked.`)
});
 
// Type text
keyboard.type("Hello World!");
 
// When key pressed
keyboard.on("press", ({ key }) => {
    console.log(`${key} was pressed.`)
});
 
// Get hex code of pixel at x=100 y=100
const hex = screen.pixelAt(100, 100);
console.log(`The colour #${hex} is at x=100, y=100`);

API

For more information, see the documentation.

mouse

See the documentation

keyboard

See the documentation

screen

See the documentation

Prerequisites

See https://github.com/octalmage/robotjs#building and https://github.com/wilix-team/iohook/blob/master/docs/os-support.md

Package Sidebar

Install

npm i xoi

Weekly Downloads

0

Version

2.0.0

License

MIT

Unpacked Size

30.5 kB

Total Files

7

Last publish

Collaborators

  • richienb