Catalog npm
Back to packageRELEASE DETAILS

1.2.0

npm

2d-context

grabs a new 2d canvas context

2d2d-contextcanvascontextcreatecreateelementelementwebgl-context
Published14 Jan 2015
Direct dependencies4
Transitive dependenciesNot calculated

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.

Declared dependencies 4

Native requirements
4 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
browserify
Environment
{
  "local_name": "browserify",
  "alias": false,
  "peer_metadata": null
}
^8.0.2development
faucet
Environment
{
  "local_name": "faucet",
  "alias": false,
  "peer_metadata": null
}
0.0.1development
tape
Environment
{
  "local_name": "tape",
  "alias": false,
  "peer_metadata": null
}
^3.0.3development
testling
Environment
{
  "local_name": "testling",
  "alias": false,
  "peer_metadata": null
}
^1.7.1development

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "b4c6b59172dd02d977e93a4855797177f8ec7700",
  "tarball": "https://registry.npmjs.org/2d-context/-/2d-context-1.2.0.tgz",
  "integrity": "sha512-ejS/jWyLtR0IKRGaic65H+nJQuQfgb95xDIebnf+L4ZQZ/ZETBcG+NElID5Fo1ETf2eUHPXVuQsVS+EVulRJmQ==",
  "signatures": [
    {
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
      "sig": "MEUCIAtzP+gdmf3DSH/LhVeRDfF4xOe8s7HFpMFMgW48i79mAiEAlIhjYpLbhzbV2Sw+9JcB2fdsGUlwygtrF4UFbHrLYEM="
    }
  ]
}

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_version:e51b0f5328ce91f0b3df37cdbecdd9e044bc9a93f6d0d1d49c28c5ac17ee7952

Other collected versions

1.3.011 Jun1.1.04 Jan1.0.24 Jan1.0.14 JanView all collected versions →