
Security News
Open Source CAI Framework Handles Pen Testing Tasks up to 3,600× Faster Than Humans
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
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.
We found that canvas-context demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.