diff --git a/src/core/Runner.js b/src/core/Runner.js index efd3e3e..21274be 100644 --- a/src/core/Runner.js +++ b/src/core/Runner.js @@ -25,13 +25,26 @@ var Common = require('./Common'); if (typeof window !== 'undefined') { _requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame - || window.mozRequestAnimationFrame || window.msRequestAnimationFrame - || function(callback){ window.setTimeout(function() { callback(Common.now()); }, 1000 / 60); }; + || window.mozRequestAnimationFrame || window.msRequestAnimationFrame; _cancelAnimationFrame = window.cancelAnimationFrame || window.mozCancelAnimationFrame || window.webkitCancelAnimationFrame || window.msCancelAnimationFrame; } + if (!_requestAnimationFrame) { + var _frameTimeout; + + _requestAnimationFrame = function(callback){ + _frameTimeout = setTimeout(function() { + callback(Common.now()); + }, 1000 / 60); + }; + + _cancelAnimationFrame = function() { + clearTimeout(_frameTimeout); + }; + } + /** * Creates a new Runner. The options parameter is an object that specifies any properties you wish to override the defaults. * @method create