Skip to content

Commit bcfd11f

Browse files
committed
Added Ticker.halt(), thanks to @izb
1 parent a96a9db commit bcfd11f

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

Diff for: README.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,11 @@ g.setStrokeStyle(8)
4545

4646
//Add the item to our stage, and call .tick(); to draw the object.
4747
var stage = new createjs.Stage(c);
48-
stage.addChid(shape);
48+
stage.addChild(shape);
4949
stage.tick();
5050

51-
//Create a PNG file
52-
fs.writeFile(__dirname + '/public/circle.png', c.toBuffer());
51+
//Create a PNG file.
52+
fs.writeFile(__dirname + '/public/circle.png', c.toBuffer(), function() {
53+
createjs.Ticker.halt();
54+
});
5355
```

Diff for: examples/SpritesheetTest.js

+2
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ p.handleVideoEncoded = function () {
8989
var cmd = "find " + __dirname + "/output -name '*.png' -exec rm -f {} \\;";
9090
exec(cmd);
9191
this.success('video.mpg');
92+
93+
createjs.Ticker.halt();
9294
}
9395

9496
p.loadImage = function (name) {

Diff for: src/node-easel.js

+18
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,21 @@ for (var i = 0; i < classes.length; i++) {
115115
var name = path.split('/').pop();
116116
require('./' + path + '.js')[name];
117117
};
118+
119+
/**
120+
* Inject custom functionality that is only required on the server.
121+
* So we can keep the same EaselJS source desktop / server.
122+
*
123+
*/
124+
125+
/**
126+
* Inject a halt method for Ticker.
127+
* Clears the Ticker's Timeout, and stops all animation.
128+
* Should only be called when your ready to stop the node instance.
129+
*
130+
*/
131+
createjs.Ticker.halt = function() {
132+
if (createjs.Ticker.timeoutID !== null) {
133+
clearTimeout(createjs.Ticker.timeoutID);
134+
}
135+
}

0 commit comments

Comments
 (0)