
Product
Introducing Webhook Events for Pull Request Scans
Add real-time Socket webhook events to your workflows to automatically receive pull request scan results and security alerts in real time.
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 346 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 1 open source maintainer 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.
Product
Add real-time Socket webhook events to your workflows to automatically receive pull request scan results and security alerts in real time.
Research
The Socket Threat Research Team uncovered malicious NuGet packages typosquatting the popular Nethereum project to steal wallet keys.
Product
A single platform for static analysis, secrets detection, container scanning, and CVE checks—built on trusted open source tools, ready to run out of the box.