1.0.0 • Published 9 years ago

force-canvas-context v1.0.0

Weekly downloads
11
License
ISC
Repository
github
Last release
9 years ago

force-canvas-context

sanity check to get the context if input happens to be the canvas; errors if it can't return a context

Build Status npm version

Installation

Download node at nodejs.org and install it, if you haven't already.

npm install force-canvas-context --save

Usage

var forceCanvasContext = require('force-canvas-context');

let canvas = document.createElement('canvas')

let context = forceCanvasContext(canvas)
context = forceCanvasContext(canvas.getContext('2d'))
context = forceCanvasContext('not a context or canvas') // Error

API

forceCanvasContext(ctx:context):context

...

License

MIT

1.0.0

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago

0.0.0

9 years ago