-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.d.ts
51 lines (51 loc) · 1.64 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
declare module "tossr" {
export type Config = {
/**
* hostname to use while rendering. Defaults to http://jsdom.ssr
*/
host: string;
/**
* event to wait for before rendering app. Defaults to 'app-loaded'
*/
eventName: string;
/**
* Executed before script is evaluated.
*/
beforeEval: Eval;
/**
* Executed after script is evaluated.
*/
afterEval: Eval;
/**
* Don't print timestamps
*/
silent: boolean;
/**
* required for apps with dynamic imports
*/
inlineDynamicImports: boolean;
/**
* required for apps with dynamic imports
*/
timeout: number;
/**
* disables caching of inlinedDynamicImports bundle
*/
dev: boolean;
errorHandler: Function;
};
/**
* Called before/after the app script is evaluated
*/
export type Eval = (dom: object) => any;
/**
* Renders an HTML page from a HTML template, an app bundle and a path
* @param {string} template Html template (or path to a HTML template).
* @param {string} script Bundled JS app (or path to bundled bundle JS app).
* @param {string} url Path to render. Ie. /blog/breathing-oxygen-linked-to-staying-alive
* @param {Partial<Config>=} options Options
* @returns {Promise<string>}
*/
export function tossr(template: string, script: string, url: string, options?: Partial<Config> | undefined): Promise<string>;
export function inlineScript(script: any, dev?: boolean): Promise<string>;
}