-
-
Save kangax/838935 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Provides requestAnimationFrame in a cross browser way. | |
* @author greggman / http://greggman.com/ | |
*/ | |
if (!window.requestAnimationFrame) { | |
window.requestAnimationFrame = | |
window.webkitRequestAnimationFrame || | |
window.mozRequestAnimationFrame || | |
window.oRequestAnimationFrame || | |
window.msRequestAnimationFrame || | |
function(callback, element) { window.setTimeout(callback, 1000 / 60) }; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Some relevant links:
It does seem to work nowadays. What changed? Does this code work fine as long as you bind the polyfilled property to
window
(sincerAF
is a member function ofwindow
, just likegetElementById
)?cc @paulirish @jakearchibald