Skip to content

Commit e55e2d2

Browse files
committed
Proposed syntax for #4.
1 parent de175e7 commit e55e2d2

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ Get the mouse location and move it.
2424
var robot = require("robotjs");
2525

2626
//Get the mouse position, retuns an object with x and y.
27-
var mouse=robot.getMousePos();
27+
var mouse=robot.mouse.pos();
2828
console.log("Mouse is at x:" + mouse.x + " y:" + mouse.y);
2929

3030
//Move the mouse down by 100 pixels.
31-
robot.moveMouse(mouse.x,mouse.y+100);
31+
robot.mouse.move(mouse.x,mouse.y+100);
3232

3333
//Left click!
34-
robot.mouseClick();
34+
robot.mouse.click();
3535
```
3636

3737
## Building

index.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,17 @@
1-
module.exports = require('./build/Release/robotjs.node');
1+
var robotjs = require('./build/Release/robotjs.node');
2+
3+
//Objects.
4+
var mouse = {}, keyboard = {};
5+
6+
//Mouse.
7+
mouse.click = robotjs.mouseClick;
8+
mouse.move = robotjs.moveMouse;
9+
mouse.pos = robotjs.getMousePos;
10+
11+
//Keyboard.
12+
keyboard.tap = robotjs.keyTap;
13+
keyboard.type = robotjs.typeString;
14+
15+
//Exports.
16+
module.exports.mouse = mouse;
17+
module.exports.keyboard = keyboard;

0 commit comments

Comments
 (0)