Last active
August 29, 2015 14:06
-
-
Save HektorW/bb0c622277e9269d6962 to your computer and use it in GitHub Desktop.
Some common vendor prefixes
This file contains 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
// Prefixes | |
(function() { | |
var w = window; | |
// performance.now | |
var p = w.performance = w.performance || {}; | |
p.now = | |
p.now || | |
p.webkitNow || | |
p.mozNow || | |
p.msNow || | |
function() { | |
return (new Date()).getTime(); | |
}; | |
// requestAnimationFrame | |
var rAF = 'equestAnimationFrame'; | |
w['r'+rAF] = | |
w['r'+rAF] || | |
w['webkitR'+rAF] || | |
w['mozR'+rAF] || | |
w['msR'+rAF] || | |
function(cb) { | |
return setTimeout(function(){ | |
cb(p.now()); | |
}, 17); | |
}; | |
// cancelAnimationFrame | |
var cAF = 'ancelAnimationFrame'; | |
w['c'+cAF] = | |
w['c'+cAF] || | |
w['webkitC'+cAF] || | |
w['mozC'+cAF] || | |
w['msC'+cAF] || | |
function(id) { | |
return clearTimeout(id); | |
}; | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment