Socket
Socket
Sign inDemoInstall

@tanem/svg-injector

Package Overview
Dependencies
Maintainers
1
Versions
218
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tanem/svg-injector

Fast, caching, dynamic inline SVG DOM injection library


Version published
Weekly downloads
168K
increased by2.14%
Maintainers
1
Weekly downloads
 
Created

What is @tanem/svg-injector?

@tanem/svg-injector is an npm package that allows you to dynamically inject SVG files into the DOM. This can be useful for manipulating SVGs with CSS and JavaScript, improving accessibility, and optimizing performance.

What are @tanem/svg-injector's main functionalities?

Basic SVG Injection

This feature allows you to inject an SVG file into a specified DOM element. The SVG content will replace the content of the target element.

const SVGInjector = require('@tanem/svg-injector');

const mySVGElement = document.querySelector('#my-svg');
SVGInjector(mySVGElement);

Batch SVG Injection

This feature allows you to inject multiple SVG files into multiple DOM elements in a single call. This is useful for batch processing multiple SVGs at once.

const SVGInjector = require('@tanem/svg-injector');

const svgElements = document.querySelectorAll('.svg-inject');
SVGInjector(svgElements);

Callback Function

This feature allows you to specify a callback function that will be called after all SVGs have been injected. This can be useful for performing additional actions once the injection is complete.

const SVGInjector = require('@tanem/svg-injector');

const mySVGElement = document.querySelector('#my-svg');
SVGInjector(mySVGElement, {
  afterAll: (elementsLoaded) => {
    console.log(`${elementsLoaded.length} SVGs injected`);
  }
});

Other packages similar to @tanem/svg-injector

Keywords

FAQs

Package last updated on 29 Jan 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc