Skip to content

I created this to be used when running Phaser.js in a Node.js environment. This can be used instead of node-canvas to simulate the existance of canvas.

License

Notifications You must be signed in to change notification settings

Cristy94/canvas-mock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

canvas-mock

I created this to be used when running Phaser.js in a Node.js environment. This can be used instead of node-canvas to simulate the existance of canvas.

Installation

Install it as any other node module:
npm install canvas-mock

Usage

The module appends the mock canvas functions to an element. This is a usage example with jsdom

var jsdom = require("jsdom").jsdom;
var window = jsdom().defaultView;
var canvasMockify = require('canvas-mock');

var Canvas = window.document.createElement('canvas');
canvasMockify(Canvas); // mock canvas functions required by Phaser.js are added

About

I created this to be used when running Phaser.js in a Node.js environment. This can be used instead of node-canvas to simulate the existance of canvas.

Resources

License

Stars

Watchers

Forks

Packages

No packages published