Security News
UK Officials Consider Banning Ransomware Payments from Public Entities
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
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 91 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.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.