Catalog npm
Back to packageRELEASE DETAILS

1.0.2

npm

2d-context

grabs a new 2d canvas context

2d2d-contextcanvascontextcreatecreateelementelementwebgl-context
Published4 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": "49f414233985ea31b4b04b594c165d10a42cb956",
  "tarball": "https://registry.npmjs.org/2d-context/-/2d-context-1.0.2.tgz",
  "integrity": "sha512-x4a+GMib1x4r4diBg32bjC/nBXunVa9vNCQyQkJ0XIkmaaXODTEGTZX7C1jhnebRWjJeTzGBcQjZ8T1SqxAmwQ==",
  "signatures": [
    {
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
      "sig": "MEUCICQfOPWRonjMpRQQhGQeKnQUbt/6/bFZZdKQU7dd3OpDAiEA3zuJXTbBHFMkEFO0347qo2neUq0emsVVLNyJAMCEHJs="
    }
  ]
}

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:1afaeb2bc943ffbe6a43bc6151decf7d4dd93e6122226a34f73a78002623f1b7

Other collected versions

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