UNPKG

2.21 kBTypeScriptView Raw
1export = WebFont;
2export as namespace WebFont;
3
4declare namespace WebFont {
5 export function load(config: WebFont.Config): void;
6 export interface Config {
7 /** Setting this to false will disable html classes (defaults to true) */
8 classes?: boolean | undefined;
9 /** Settings this to false will disable callbacks/events (defaults to true) */
10 events?: boolean | undefined;
11 /** Time (in ms) until the fontinactive callback will be triggered (defaults to 5000) */
12 timeout?: number | undefined;
13 /** This event is triggered when all fonts have been requested. */
14 loading?(): void;
15 /** This event is triggered when the fonts have rendered. */
16 active?(): void;
17 /** This event is triggered when the browser does not support linked fonts or if none of the fonts could be loaded. */
18 inactive?(): void;
19 /** This event is triggered once for each font that's loaded. */
20 fontloading?(familyName: string, fvd: string): void;
21 /** This event is triggered once for each font that renders. */
22 fontactive?(familyName: string, fvd: string): void;
23 /** This event is triggered if the font can't be loaded. */
24 fontinactive?(familyName: string, fvd: string): void;
25
26 /** Child window or iframe to manage fonts for */
27 context?: Window | undefined;
28
29 custom?: Custom | undefined;
30 google?: Google | undefined;
31 typekit?: Typekit | undefined;
32 fontdeck?: Fontdeck | undefined;
33 monotype?: Monotype | undefined;
34 }
35 export interface Google {
36 api?: string | undefined;
37 families: string[];
38 text?: string | undefined;
39 }
40 export interface Typekit {
41 id?: string | undefined;
42 }
43 export interface Custom {
44 families?: string[] | undefined;
45 urls?: string[] | undefined;
46 testStrings?: { [fontFamily: string]: string } | undefined;
47 }
48 export interface Fontdeck {
49 id?: string | undefined;
50 }
51 export interface Monotype {
52 projectId?: string | undefined;
53 version?: number | undefined;
54 loadAllFonts?: boolean | undefined;
55 }
56}