Skip to content

Commit

Permalink
Proposed syntax for #4.
Browse files Browse the repository at this point in the history
  • Loading branch information
octalmage committed Jan 31, 2015
1 parent de175e7 commit e55e2d2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ Get the mouse location and move it.
var robot = require("robotjs");

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

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

//Left click!
robot.mouseClick();
robot.mouse.click();
```

## Building
Expand Down
18 changes: 17 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
module.exports = require('./build/Release/robotjs.node');
var robotjs = require('./build/Release/robotjs.node');

//Objects.
var mouse = {}, keyboard = {};

//Mouse.
mouse.click = robotjs.mouseClick;
mouse.move = robotjs.moveMouse;
mouse.pos = robotjs.getMousePos;

//Keyboard.
keyboard.tap = robotjs.keyTap;
keyboard.type = robotjs.typeString;

//Exports.
module.exports.mouse = mouse;
module.exports.keyboard = keyboard;

0 comments on commit e55e2d2

Please sign in to comment.