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, webgpu), optionally offscreen for possible use in a Worker.
Create a RenderingContext (2d, webgl, webgl2, bitmaprenderer, webgpu), optionally offscreen for possible use in a Worker.
See the example and its source with a Worker implementation.
npm install canvas-context
import createCanvasContext from "canvas-context";
const { context, canvas } = createCanvasContext("2d", {
width: 100,
height: 100,
offscreen: true,
});
"2d"
| "webgl"
| "experimental-webgl"
| "webgl2"
| "webgl2-compute"
| "bitmaprenderer"
| "gpupresent"
| "webgpu"
A DOMString containing the context identifier defining the drawing context associated to the canvas.
object
Options for canvas creation. All optional.
object
CanvasContextReturnValue
⏏Create a RenderingContext (2d, webgl, webgl2, bitmaprenderer, webgpu), optionally offscreen for possible use in a Worker.
Kind: Exported function
Param | Type | Default |
---|---|---|
[contextType] | ContextType | "2d" |
[options] | CanvasContextOptions | {} |
"2d"
| "webgl"
| "experimental-webgl"
| "webgl2"
| "webgl2-compute"
| "bitmaprenderer"
| "gpupresent"
| "webgpu"
A DOMString containing the context identifier defining the drawing context associated to the canvas.
object
Options for canvas creation. All optional.
Kind: global typedef Properties
Name | Type | Default | Description |
---|---|---|---|
[width] | number | 300 | Request an initial canvas width. |
[height] | number | 150 | Request an initial canvas height. |
[offscreen] | boolean | false | Request an offscreen canvas. |
[worker] | boolean | false | Handle use in a worker. |
[contextAttributes] | CanvasRenderingContext2DSettings | WebGLContextAttributes | {} | Attributes to be passed to getContext. |
object
Kind: global typedef Properties
Name | Type |
---|---|
canvas | HTMLCanvasElement | OffscreenCanvas |
context | RenderingContext |
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.