UNPKG

1.2 kBTypeScriptView Raw
1import { DOMParser } from './types';
2/**
3 * `node-canvas` exports.
4 */
5interface ICanvas {
6 createCanvas(width: number, height: number): any;
7 loadImage(src: string): Promise<any>;
8}
9/**
10 * WHATWG-compatible `fetch` function.
11 */
12type Fetch = (input: any, config?: any) => Promise<any>;
13interface IConfig {
14 /**
15 * XML/HTML parser from string into DOM Document.
16 */
17 DOMParser: DOMParser;
18 /**
19 * `node-canvas` exports.
20 */
21 canvas: ICanvas;
22 /**
23 * WHATWG-compatible `fetch` function.
24 */
25 fetch: Fetch;
26}
27/**
28 * Options preset for `node-canvas`.
29 * @param config - Preset requirements.
30 * @param config.DOMParser - XML/HTML parser from string into DOM Document.
31 * @param config.canvas - `node-canvas` exports.
32 * @param config.fetch - WHATWG-compatible `fetch` function.
33 * @returns Preset object.
34 */
35export declare function node({ DOMParser, canvas, fetch }: IConfig): {
36 window: any;
37 ignoreAnimation: boolean;
38 ignoreMouse: boolean;
39 DOMParser: DOMParser;
40 fetch: Fetch;
41 createCanvas: (width: number, height: number) => any;
42 createImage: (src: string) => Promise<any>;
43};
44export {};
45//# sourceMappingURL=node.d.ts.map
\No newline at end of file