forked from kuitos/import-html-entry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
33 lines (23 loc) · 837 Bytes
/
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
/**
* @author kuitos
* @since 2019-05-16
*/
interface IImportResult {
template: string;
assetPublicPath: string;
execScripts<T>(sandbox?: object): Promise<T>;
getExternalScripts(): Promise<string[]>;
getExternalStyleSheets(): Promise<string[]>;
}
export type ImportEntryOpts = {
fetch?: Function;
getDomain?: Function;
getTemplate?: (tpl: string) => string;
}
type ExecScriptsOpts = {
fetch?: Function;
}
export type Entry = string | { styles?: string[], scripts?: string[], html?: string };
export function execScripts<T>(entry: string | null, scripts: string[], proxy: Window, opts?: ExecScriptsOpts): Promise<T>;
export default function importHTML(url: string, opts?: ImportEntryOpts | Function): Promise<IImportResult>;
export function importEntry(entry: Entry, opts?: ImportEntryOpts): Promise<IImportResult>;