npm.io
1.1.0 • Published 1 year ago

@types/svg-injector

Licence
MIT
Version
1.1.0
Deps
0
Size
5 kB
Vulns
0
Weekly
0
Stars
51.4K

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.

index.d.ts

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 1716 GMT
  • Dependencies: none

Credits

These definitions were written by Patrick Westerhoff.