forked from Automattic/jetpack-boost-critical-css-gen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
34 lines (29 loc) · 1.18 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
interface BrowserInterface {}
interface PuppeteerPage {
setViewport( args: { width: number, height: number } ): void;
evaluateHandle( getter: () => any ): Promise< any >;
evaluate( method: string | ((arg1: T, ...args: any[]) => any), window: Window, ...args: any[] ): Promise< any >;
}
export declare class BrowserInterfaceIframe implements BrowserInterface {
constructor( args?: {
requestGetParameters?: { [ key: string ]: string },
loadTimeout?: number,
verifyPage?: ( url: string, contentWindow: Window, contentDocument: Document ) => boolean,
allowScripts?: boolean, // Defaults to true if unspecified.
} );
}
export declare class BrowserInterfacePuppeteer implements BrowserInterface {
constructor( pages: { [ url: string ]: PuppeteerPage } );
}
export interface CssFilters {
atRules?: ( name: string ) => boolean,
properties?: ( name: string, value: string ) => boolean,
}
export declare function generateCriticalCSS( args: {
browserInterface: BrowserInterface,
progressCallback?: ( step: number, stepCount: number ) => void,
urls: string[],
viewports: Array< { width: number, height: number } >,
filters?: CssFilters,
successRatio?: number,
} ): Promise< [ string, Error[] ] >;