0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-11-27 09:50:52 -05:00

fix Matter.Runner for node

This commit is contained in:
liabru 2015-08-15 20:38:40 +01:00
parent a80fbc133c
commit ad55b85912

View file

@ -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.
@ -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