-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.d.ts
60 lines (53 loc) · 1.88 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
59
60
import { CookieJar } from 'cookiejar';
import { Response as FetchResponse } from 'node-fetch-commonjs';
declare global {
interface Window {
prototype: Window;
}
interface Document {
prototype: Document;
}
interface MutationObserver {
prototype: MutationObserver;
new(callback: MutationCallback): MutationObserver;
}
}
declare module "@expressen/tallahassee" {
export class BrowserTab {
/** Cheerio context */
get $(): cheerio.Cheerio;
get jar(): CookieJar;
get response(): FetchResponse;
get _pending(): Promise<BrowserTab>;
window: Window;
document: Document;
navigateTo(uri: string, headers?: Record<string, any>, statusCode?: number): Promise<BrowserTab>;
load(markup: string): BrowserTab;
focusIframe(element: HTMLElement, src: string): Promise<BrowserTab>;
runScript(script: HTMLElement): void;
runScripts(context?: Node): void;
mutated(targetNode: Node, config?: { childList?: boolean, attributes?: boolean }): Promise<any[]>;
}
export class WebPage {
navigateTo(uri: string, headers?: Record<string, any>, statusCode?: number): Promise<BrowserTab>;
load(markup: string): Promise<BrowserTab>;
submit(uri: string, options?: Record<string, any>): Promise<BrowserTab>;
fetch(uri: string, requestOptions?: Record<string, any>): Promise<FetchResponse>;
}
class Browser {
constructor(origin: any, options?: Record<string, any>);
constructor(options?: Record<string, any>);
navigateTo(uri: string, headers?: Record<string, any>, statusCode?: number): Promise<BrowserTab>;
load(markup: string): Promise<BrowserTab>;
}
interface DOMInterface {
Document: Document;
HTMLCollection: HTMLCollection;
IntersectionObserver: IntersectionObserver;
MutationObserver: MutationObserver;
Window: Window;
Storage: Storage;
}
export const DOM: DOMInterface;
export = Browser;
}