forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
svg-injector.d.ts
43 lines (38 loc) · 1.3 KB
/
svg-injector.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
// Type definitions for SVG Injector
// Project: https://github.com/iconic/SVGInjector
// Definitions by: Patrick Westerhoff <https://github.com/poke>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare interface SVGInjector {
/**
* Replace the given elements with their full inline SVG DOM elements.
*
* @param elements Array of or single DOM element.
* @param options Injector options.
* @param done Callback that receives the injected element count as parameter.
*/
(elements: Node | NodeList | Array<Node>, options?: SVGInjectorOptions, done?: (elementCount: number) => void): void;
}
declare interface SVGInjectorOptions {
/**
* Whether to run scripts blocks found in the SVG.
*
* Possible values:
* 'always' — Run scripts every time.
* 'once' — Only run scripts once for each SVG.
* 'never' — Ignore scripts (default)
*/
evalScripts?: string;
/**
* Location of fallback pngs, if desired.
*/
pngFallback?: string;
/**
* Callback to run during each SVG injection. The SVG element is passed if
* the injection was successful.
*/
each?: (svg: SVGElement | string) => void;
}
declare module "svg-injector" {
var SVGInjector: SVGInjector;
export = SVGInjector;
}