konva/konva-node/index.js
2019-04-03 18:08:16 -05:00

26 lines
507 B
JavaScript

var Konva = require('konva');
var Canvas = require('canvas');
Konva.window = {
Image: Canvas.Image,
devicePixelRatio: 1
};
Konva.document = {
createElement: function() {},
documentElement: {
addEventListener: function() {}
}
};
Konva.window = new JSDOM(
'<!DOCTYPE html><html><head></head><body></body></html>'
).window;
Konva.document = Konva.window.document;
Konva.window.Image = Canvas.Image;
Konva.Util.createCanvasElement = () => {
return new Canvas();
};
module.exports = Konva;