Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

path2d-polyfill

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

path2d-polyfill

Polyfills Path2D api for canvas rendering

  • 1.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
319K
decreased by-60.43%
Maintainers
1
Weekly downloads
 
Created
Source

path2d-polyfill

Build, Test and maybe Publish

Polyfills Path2D api for rendering SVG paths in canvas

Use this to enable Path2D features in e.g. Internet Explorer.

Usage

npm install --save path2d-polyfill

include directly in html-page

<html>
  <head>
    ...
  </head>
  <body>
    <script
      lang="javascript"
      src="node_modules/path2d-polyfill/path2d-polyfill.js"
    ></script>
  </body>
</html>

or import with module bundler e.g. webpack before you try to use the feature

require('path2d-polyfill');

or if you use transpiler to support es2015+ modules

import 'path2d-polyfill';

Support table

MethodSupported
constructor(SVGPath)Yes
addPath()Yes
closePath()Yes
moveTo()Yes
lineTo()Yes
bezierCurveTo()Yes
quadraticCurveTo()Yes
arc()Yes
ellipse()Yes
rect()Yes

Example of usage

ctx.fill(new Path2D('M 80 80 A 45 45 0 0 0 125 125 L 125 80 Z'));
ctx.stroke(new Path2D('M 80 80 A 45 45 0 0 0 125 125 L 125 80 Z'));

See it in action

Clone this repo and run the following

yarn
yarn start

open http://localhost:10001 to see the example page.

Contributing

Recommended to use vscode with the prettier extension and use "format on save" option

Keywords

FAQs

Package last updated on 27 Aug 2020

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