Catalog npm
PACKAGE EXPLORERView in registry

2d-context

npm

grabs a new 2d canvas context

2d2d-contextcanvascontextcreatecreateelementelementwebgl-context
Versions collected5
Direct dependencies5From release 1.3.0
Last observed20 Oct, 19:10 UTC

README

Current package documentation

2d-context

Grabs a CanvasRenderingContext2D, returning null if it doesn't exist. Similar to webgl-context.

var context = require('2d-context')()
var canvas = context.canvas

or

var canvas = document.createElement('canvas')

var context = require('2d-context')({
    canvas: canvas,
    alpha: true,
    width: 256,
    height: 256    
})

Usage

NPM

ctx = require('2d-context')([opt])

Gets a new canvas context with optional parameters:

  • canvas a canvas element to use, otherwise creates a new element
  • width a width to set, otherwise no change
  • height a height to set, otherwise no change
  • other attributes are passed to the getContext call, like alpha and storage

You can then get a reference of the canvas element with ctx.canvas.

License

MIT, see LICENSE.md for details.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 5

Collected releases
VersionPublishedDirect dependenciesOpen version
1.3.0Registry latest11 Jun 20155
1.2.014 Jan 20154
1.1.04 Jan 20154
1.0.24 Jan 20154
1.0.14 Jan 20154

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
mattdesl/2d-context

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 19:10 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:1abf89f32d34a3c8508251369a00a09a15ca26ab79b5342dd79e0b253e554d53