Skip to content

Commit

Permalink
fix Matter.Runner for node
Browse files Browse the repository at this point in the history
  • Loading branch information
liabru committed Aug 15, 2015
1 parent a80fbc1 commit ad55b85
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/core/Runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ var Runner = {};

(function() {

if (typeof window === 'undefined') {
// TODO: support Runner on non-browser environments.
return;
}
var _requestAnimationFrame,
_cancelAnimationFrame;

var _requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame
if (typeof window !== 'undefined') {
_requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame
|| window.mozRequestAnimationFrame || window.msRequestAnimationFrame
|| function(callback){ window.setTimeout(function() { callback(Common.now()); }, 1000 / 60); };

var _cancelAnimationFrame = window.cancelAnimationFrame || window.mozCancelAnimationFrame
_cancelAnimationFrame = window.cancelAnimationFrame || window.mozCancelAnimationFrame
|| window.webkitCancelAnimationFrame || window.msCancelAnimationFrame;
}

/**
* Creates a new Runner. The options parameter is an object that specifies any properties you wish to override the defaults.
Expand Down Expand Up @@ -163,7 +163,7 @@ var Runner = {};
Events.trigger(runner, 'afterUpdate', event);

// render
if (engine.render) {
if (engine.render && engine.render.controller) {
Events.trigger(runner, 'beforeRender', event);
Events.trigger(engine, 'beforeRender', event); // @deprecated

Expand Down

0 comments on commit ad55b85

Please sign in to comment.