oj-svg-loader
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

SVG Loader

mount

mount(options?: IOptions): SVGLoader[] mounts all html elements containing the data-svg-loader attribute that do not contain the data-loaded attribute.

<div data-svg-loader="https://url.to/image.svg"></div>
<div data-svg-loader="https://url.to/image.svg" replace></div>
mount()

constructor

new SVGLoader(root: HTMLElement, options?: IOptions): SVGLoader Load a single SVG. The SVG is cached. The SVG will only be downloaded once, and shared between any other SVGLoader instance.

new SVGLoader(document.querySelector("svg"), { url: "https://url.to/image.svg" })

load

load(url: string): void Replaces the current SVG with the new SVG.

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i oj-svg-loader

      Weekly Downloads

      0

      Version

      1.0.1

      License

      MIT

      Unpacked Size

      19.8 kB

      Total Files

      10

      Last publish

      Collaborators

      • orange-juice