Skip to content

Instantly share code, notes, and snippets.

@mvasilkov
Created October 23, 2012 09:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mvasilkov/3937790 to your computer and use it in GitHub Desktop.
Save mvasilkov/3937790 to your computer and use it in GitHub Desktop.
requestAnimationFrame.js
/*
requestAnimationFrame polyfill, by Mark Vasilkov
http://careers.stackoverflow.com/mvasilkov
Released into the public domain.
*/
if (typeof requestAnimationFrame === "undefined") {
["moz", "webkit", "ms"].some(function(p) {
var fun = this[p + "RequestAnimationFrame"]
if (typeof fun === "function") {
return requestAnimationFrame = fun
}
}) || (requestAnimationFrame = function(fun) {
setTimeout(fun, 16)
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment