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

2d-context

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

2d-context - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

7

index.js

@@ -8,10 +8,7 @@ module.exports = function createCanvas2D(opt) {

canvas.height = opt.height
if (typeof canvas.getContext !== 'function')
throw new Error('canvas.getContext() not supported')
try {
return canvas.getContext('2d', opt)
return canvas.getContext('2d', opt) || null
} catch (e) {
throw new Error('could not get 2D context: ' + e)
return null
}
}
{
"name": "2d-context",
"version": "1.0.2",
"version": "1.1.0",
"description": "grabs a new 2d canvas context",

@@ -5,0 +5,0 @@ "main": "index.js",

# 2d-context
Creates a new canvas with a 2D context, returning the context.
Grabs a CanvasRenderingContext2D, returning null if it doesn't exist. Similar to [webgl-context](https://nodei.co/npm/webgl-context/).

@@ -29,3 +29,3 @@ ```js

Creates a new canvas with optional parameters:
Gets a new canvas context with optional parameters:

@@ -32,0 +32,0 @@ - `canvas` a canvas element to use, otherwise creates a new element

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