forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
phantom.d.ts
78 lines (65 loc) · 3.84 KB
/
phantom.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Type definitions for PhantomJS bridge for NodeJS 0.7.0
// Project: https://github.com/sgentle/phantomjs-node
// Definitions by: horiuchi <https://github.com/horiuchi/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "phantom" {
function create(callback: (ph: PhantomJS) => void): void;
function create(options: ICreateOptions, callback: (ph: PhantomJS) => void): void;
function create(arg: string, callback: (ph: PhantomJS) => void): void;
function create(arg: string, options: ICreateOptions, callback: (ph: PhantomJS) => void): void;
function create(arg1: string, arg2: string, callback: (ph: PhantomJS) => void): void;
function create(arg1: string, arg2: string, options: ICreateOptions, callback: (ph: PhantomJS) => void): void;
function create(arg1: string, arg2: string, arg3: string, callback: (ph: PhantomJS) => void): void;
function create(arg1: string, arg2: string, arg3: string, options: ICreateOptions, callback: (ph: PhantomJS) => void): void;
interface PhantomJS {
createPage(callback: (page: WebPage) => void): void;
exit(returnValue?: number): void;
injectJs(filename: string, callback?: (result: boolean) => void): void;
addCookie(name: string, value: string, domain: string, callback?: (res: boolean) => void): void;
clearCookies(callback?: () => void): void;
getCookies(callback: (cookies: { name: string; value: string; domain?: string; }[]) => void): void;
}
interface WebPage {
open(url: string, callback: (status: string) => void): void;
close(): void;
get(key: string, callback: (result: any) => void): void;
set(key: string, value: any, callback?: (result: any) => void): void;
setHeaders(headers: Object, callback?: () => void): void;
setViewportSize(width: number, height: number, callback?: () => void): void;
setPaperSize(options: IPaperSizeOptions, callback?: () => void): void;
setZoomFactor(factor: number, callback?: () => void): void;
evaluate(callback: () => void): void;
evaluate<R>(callback: () => R, returnCallback: (result: R) => void): void;
evaluate<T>(callback: (arg: T) => void, returnCallback: () => void, arg: T): void;
evaluate<T, R>(callback: (arg: T) => R, returnCallback: (result: R) => void, arg: T): void;
evaluate<T1, T2, R>(callback: (arg1: T1, arg2: T2) => R, returnCallback: (result: R) => void, arg1: T1, arg2: T2): void;
evaluate<T1, T2, T3, R>(callback: (arg1: T1, arg2: T2, arg3: T3) => R, returnCallback: (result: R) => void, arg1: T1, arg2: T2, arg3: T3): void;
includeJs(url: string, callback?: () => void): void;
injectJs(filename: string, callback?: (res: boolean) => void): void;
sendEvent(mouseEventType: string, mouseX: number, mouseY: number, button?: string): void;
sendEvent(keyboardEventType: string, key: string, null1?: void, null2?: void, modifier?: number): void;
uploadFile(selector: string, filename: string): void;
render(filename: string, callback?: () => void): void;
render(filename: string, options?: { format?: string; quality?: string; }, callback?: () => void): void;
renderBase64(type: string, callback: (data: string) => void): void;
goBack(): void;
goForward(): void;
reload(): void;
getContent(callback: (content: string) => void): void;
setContent(html: string, url: string, callback?: (status: string) => void): void;
getCookies(callback: (cookies: { name: string; value: string; domain?: string; }[]) => void): void;
}
interface ICreateOptions {
binary?: string;
hostname?: string;
path?: string;
port?: number;
}
interface IPaperSizeOptions {
width?: string;
height?: string;
format?: string;
orientation?: string;
margin?: any; // string | { top?: string; left?: string; bottom?: string; right?: string; }
}
}