Skip to content

Commit

Permalink
Add typescript declaration file
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanlievens committed Aug 14, 2016
1 parent 772764b commit 56b90e0
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
31 changes: 31 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
export interface Bitmap {
width: number
height: number
image: any
byteWidth: number
bitsPerPixel: number
bytesPerPixel: number
colorAt(x: number, y: number): string
}

export interface Screen {
capture(x?: number, y?: number, width?: number, height?: number): Bitmap
}

export function setKeyboardDelay(ms: number) : void
export function keyTap(key: string, modifier?: string | string[]) : void
export function keyToggle(key: string, down: string, modifier?: string | string[]) : void
export function typeString(string: string) : void
export function typeStringDelayed(string: string, cpm: number) : void
export function setMouseDelay(delay: number) : void
export function moveMouse(x: number, y: number) : void
export function moveMouseSmooth(x: number, y: number) : void
export function mouseClick(button?: string, double?: boolean) : void
export function mouseToggle(down?: string, button?: boolean) : void
export function dragMouse(x: number, y: number) : void
export function scrollMouse(magnitude: number, direction: string) : void
export function getMousePos(): { x: number, y: number }
export function getPixelColor(x: number, y: number): string
export function getScreenSize(): { width: number, height: number }

export var screen: Screen
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.4.4",
"description": "Node.js Desktop Automation.",
"main": "index.js",
"typings": "index.d.ts",
"scripts": {
"test": "node test/all.js",
"install": "prebuild --install"
Expand Down

0 comments on commit 56b90e0

Please sign in to comment.