forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
phantom.d.ts
63 lines (51 loc) · 2.24 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
// Type definitions for PhantomJS bridge for NodeJS
// Project: https://github.com/sgentle/phantomjs-node
// Definitions by: horiuchi <https://github.com/horiuchi/>, Random <https://github.com/llRandom/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "phantom" {
function create(args?: string[]): Promise<PhantomJS>;
interface PhantomJS {
createPage(): Promise<WebPage>;
exit(returnValue?: number): void;
}
interface WebPage {
open(url: string): Promise<string>;
close(): Promise<void>;
evaluate<R>(callback: () => R): Promise<R>;
evaluate<T>(callback: (arg: T) => void, arg: T): Promise<void>;
evaluate<T, R>(callback: (arg: T) => R, arg: T): Promise<R>;
evaluate<T1, T2, R>(callback: (arg1: T1, arg2: T2) => R, arg1: T1, arg2: T2): Promise<R>;
evaluate<T1, T2, T3, R>(callback: (arg1: T1, arg2: T2, arg3: T3) => R, arg1: T1, arg2: T2, arg3: T3): Promise<R>;
evaluate<R>(callback: (...args: any[]) => R, ...args: any[]): Promise<R>;
includeJs(url: string): Promise<void>;
injectJs(filename: string): Promise<boolean>;
sendEvent(mouseEventType: string, mouseX?: number, mouseY?: number, button?: string): Promise<void>;
sendEvent(keyboardEventType: string, key: string, null1?: void, null2?: void, modifier?: number): Promise<void>;
render(filename: string): Promise<void>;
render(filename: string, options?: { format?: string; quality?: string; }): Promise<void>;
renderBase64(type: string): Promise<string>;
setContent(html: string, url: string): Promise<string>;
property<T>(key: string): Promise<T>;
property<T>(key: string, value: T): Promise<void>;
setting<T>(key: string): Promise<T>;
addCookie(cookie: ICookie): Promise<boolean>;
deleteCookie(cookieName: string): Promise<boolean>;
clearCookies(): Promise<void>;
}
interface ICookie {
name: string,
value: string,
domain?: string,
path: string,
httponly?: boolean,
secure?: boolean,
expires?: Date
}
interface IPaperSizeOptions {
width?: string;
height?: string;
format?: string;
orientation?: string;
margin?: any; // string | { top?: string; left?: string; bottom?: string; right?: string; }
}
}