Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
lavrton committed May 6, 2016
1 parent 9470bc5 commit 2c772bf
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ This project adheres to [Semantic Versioning](http://semver.org/).

## [Not released][Not released]

### Changed
- typescript definition in npm package
- [email protected], [email protected], [email protected] support


## [0.12.4][2016-04-19]

### Changed
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ define(['./konva'], function(Konva) {
###3 CommonJS style with npm:

```bash
npm install konva
npm install konva --save
```

```javascript
Expand Down Expand Up @@ -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 [email protected], [email protected], [email protected]

#Change log

Expand Down
5 changes: 3 additions & 2 deletions resources/nodejs-demo.js
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -30,6 +30,7 @@ stage.setSize({
height : 200
});


// check tween works
var tween = new Konva.Tween({
node : rect,
Expand Down Expand Up @@ -67,4 +68,4 @@ setTimeout(function(){

}
});
}, 1050);
}, 1050);
4 changes: 2 additions & 2 deletions src/Global.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@
var Canvas = require('canvas');
var jsdom = require('jsdom').jsdom;

Konva.document = jsdom('<!DOCTYPE html><html><head></head><body></body></html>');
Konva.window = Konva.document.parentWindow;
Konva.window = jsdom('<!DOCTYPE html><html><head></head><body></body></html>').defaultView;
Konva.document = Konva.window.document;
Konva.window.Image = Canvas.Image;
Konva._nodeCanvas = Canvas;
}
Expand Down

0 comments on commit 2c772bf

Please sign in to comment.