Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
canvas-context
Advanced tools
Create a RenderingContext (2d, webgl, webgl2, bitmaprenderer), optionally offscreen for possible use in a Worker.
Create a RenderingContext (2d, webgl, webgl2, bitmaprenderer), optionally offscreen for possible use in a Worker.
See the demo and its source for an example with Worker implementation.
npm install canvas-context
const createCanvasContext = require("canvas-context");
const { context, canvas } = createCanvasContext("2d", {
width: 100,
height: 100,
offscreen: true
});
createCanvasContext(contextType, options): { context: RenderingContext, canvas: HTMLCanvasElement }
type ContextType =
| "2d"
| "webgl"
| "experimental-webgl"
| "webgl2"
| "bitmaprenderer";
Option | Type | Default | Description |
---|---|---|---|
contextType | ContextType | "2d" | Context identifier defining the drawing context associated to the canvas |
options.canvas | HTMLCanvasElement? | An optional canvas. Necessary when window === "undefined" (eg. Node or Worker context) | |
options.width | number? | 300 | Set canvas.width (should be an integer >= 0) |
options.height | number? | 150 | Set canvas.height (should be an integer >= 0) |
options.offscreen | boolean? | false | Create an OffscreenCanvas or transferControlToOffscreen() if options.canvas |
options.worker | boolean? | false | Try to get an OffscreenCanvas and return only the canvas so it can be transferred in a Worker |
MIT. See license file.
FAQs
Create a RenderingContext (2d, webgl, webgl2, bitmaprenderer, webgpu), optionally offscreen for possible use in a Worker.
The npm package canvas-context receives a total of 55 weekly downloads. As such, canvas-context popularity was classified as not popular.
We found that canvas-context demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.