-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathindex.d.ts
58 lines (55 loc) · 1.83 KB
/
index.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
export default class ChromeRender {
static new(params: {
/**
* max tab chrome will open to render pages, default is no limit, `maxTab` used to avoid open to many tab lead to chrome crash.
*/
maxTab?: number,
}): Promise<ChromeRender>;
/**
* render page in chrome, and return page html string
* @param params
* @returns {Promise.<string>} page html string
*/
render(params: {
/**
* is required, web page's URL
*/
url: string,
/**
* `object {cookieName:cookieValue}` set HTTP cookies when request web page
*/
cookies?: {
[cookieName: string]: string,
},
/**
* `object {headerName:headerValue}` add HTTP headers when request web page
*/
headers?: {
[headerName: string]: string,
},
/**
* `boolean` whether use `window.chromeRenderReady()` to notify chrome-render page has ready. default is false chrome-render use `domContentEventFired` as page has ready.
*/
useReady?: boolean,
/**
* inject script to evaluate when page on load
*/
script?: string,
/**
* `number` in ms, `render()` will throw error if html string can't be resolved after `renderTimeout`, default is 5000ms.
*/
renderTimeout?: number,
/**
* `object` Overrides the values of device screen dimensions, same as https://chromedevtools.github.io/devtools-protocol/tot/Emulation/#method-setDeviceMetricsOverride
*/
deviceMetricsOverride?: object,
/**
* `boolean` if `true` after render chrome instance will navigate to `about:blank` to free resources. default is true. setting to `false` may increase page load speed when rendering the same website.
*/
clearTab?: boolean,
}): Promise<string>;
/**
* destroyPoll this chrome render, kill chrome, release all resource
*/
destroyRender(): Promise<void>;
}