@types/svg-injector
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

Installation

npm install --save @types/svg-injector

Summary

This package contains type definitions for svg-injector (https://github.com/iconic/SVGInjector).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/svg-injector.

declare namespace SVGInjector {
    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 | Node[],
            options?: SVGInjectorOptions,
            done?: (elementCount: number) => void,
        ): void;
    }

    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?: "always" | "once" | "never" | undefined;

        /**
         * Location of fallback pngs, if desired.
         */
        pngFallback?: string | undefined;

        /**
         * Callback to run during each SVG injection. The SVG element is passed if
         * the injection was successful.
         */
        each?: ((svg: SVGElement | string) => void) | undefined;
    }
}

declare const SVGInjector: SVGInjector.SVGInjector;
export = SVGInjector;
export as namespace SVGInjector;

Additional Details

  • Last updated: Sat, 28 Sep 2024 17:07:16 GMT
  • Dependencies: none

Credits

These definitions were written by Patrick Westerhoff.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/svg-injector

Weekly Downloads

501

Version

1.1.0

License

MIT

Unpacked Size

5.28 kB

Total Files

5

Last publish

Collaborators

  • types