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:
parent
a80fbc133c
commit
ad55b85912
1 changed files with 7 additions and 7 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue