From 2c772bfea42f450f07becaeda3ec9b4374f3d48b Mon Sep 17 00:00:00 2001 From: Anton Lavrenov Date: Fri, 6 May 2016 14:31:35 +0700 Subject: [PATCH] node@5.10.1, canvas@1.3.14, jsdom@8.5.0 support --- CHANGELOG.md | 5 +++++ README.md | 14 +++++++------- resources/nodejs-demo.js | 5 +++-- src/Global.js | 4 ++-- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f735835..c6e69053 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## [Not released][Not released] +### Changed +- typescript definition in npm package +- node@5.10.1, canvas@1.3.14, jsdom@8.5.0 support + + ## [0.12.4][2016-04-19] ### Changed diff --git a/README.md b/README.md index 9173da8d..e7e74bf0 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ define(['./konva'], function(Konva) { ###3 CommonJS style with npm: ```bash -npm install konva +npm install konva --save ``` ```javascript @@ -110,18 +110,18 @@ import 'konva/src/shapes/rect'; ###5 NodeJS -Support for node 0.12.x only for now. You have to install some deps manually to use Konva in nodejs env. -We are using [node-canvas](https://github.com/LearnBoost/node-canvas) to create canvas element. +We are using [node-canvas](https://github.com/Automattic/node-canvas) to create canvas element. -1. Install node-canvas dependencies [https://github.com/LearnBoost/node-canvas/wiki/_pages](https://github.com/LearnBoost/node-canvas/wiki/_pages) -2. `npm install canvas@1.2.x` -2. `npm install jsdom@3.x` (jsdom v4 require iojs) -3. `npm install konva` +1. Install node-canvas dependencies [https://github.com/Automattic/node-canvas](https://github.com/Automattic/node-canvas) +2. `npm install canvas --save` +2. `npm install jsdom --save` +3. `npm install konva --save` See file `resources/nodejs-demo.js` for example. +Last tested with node@5.10.1, canvas@1.3.14, jsdom@8.5.0 #Change log diff --git a/resources/nodejs-demo.js b/resources/nodejs-demo.js index ffbb83a6..1b881f57 100644 --- a/resources/nodejs-demo.js +++ b/resources/nodejs-demo.js @@ -1,5 +1,5 @@ var fs = require('fs'), - Konva = require('../dist/konva-dev'); + Konva = require('konva'); // Create stage. Container parameter is not required in NodeJS. @@ -30,6 +30,7 @@ stage.setSize({ height : 200 }); + // check tween works var tween = new Konva.Tween({ node : rect, @@ -67,4 +68,4 @@ setTimeout(function(){ } }); -}, 1050); \ No newline at end of file +}, 1050); diff --git a/src/Global.js b/src/Global.js index 63210981..79555812 100644 --- a/src/Global.js +++ b/src/Global.js @@ -230,8 +230,8 @@ var Canvas = require('canvas'); var jsdom = require('jsdom').jsdom; - Konva.document = jsdom(''); - Konva.window = Konva.document.parentWindow; + Konva.window = jsdom('').defaultView; + Konva.document = Konva.window.document; Konva.window.Image = Canvas.Image; Konva._nodeCanvas = Canvas; }