force-canvas
v1.0.0
Published
sanity check to get the canvas if input happens to be the context; errors if it can't return a canvas
Downloads
6
Maintainers
Readme
force-canvas
sanity check to get the canvas if input happens to be the context; errors if it can't return a canvas
Installation
Download node at nodejs.org and install it, if you haven't already.
npm install force-canvas --save
Usage
var forceCanvas = require('force-canvas');
let canvas = document.createElement('canvas')
canvas = forceCanvas(canvas)
canvas = forceCanvas(canvas.getContext('2d'))
canvas = forceCanvas('not a canvas or context') // Error
API
forceCanvas(canvas:canvas):canvas
License
MIT