From 9d4b79b554981dce68d759c6de0912f87b1ee287 Mon Sep 17 00:00:00 2001 From: Cristian Carlesso Date: Sat, 14 Nov 2015 15:13:32 +0000 Subject: [PATCH] requestAnimationFrame passes a DOMHighResTimeStamp, polyfilling it rAF passes a DOMHighResTimeStamp (Performance.now()) or a DOMTimeStamp (Date.now()) if the prefixed version is used, since Performance.now() is not available, either using Date.now() or +new Date() should be enough, last one is known to work in any browser/server, so seems the best choice here even if it may be slower --- defer.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/defer.js b/defer.js index c890992..464ea11 100644 --- a/defer.js +++ b/defer.js @@ -89,7 +89,9 @@ var requestAnimationFrame = global.requestAnimationFrame || global.oRequestAnimationFrame || global.msRequestAnimationFrame || function(callback) { - setTimeout(callback, 1e3 / 60) + setTimeout(function(){ + callback(+new Date()) + }, 1e3 / 60) } defer.frame = function(callback, context){