Skip to content

Instantly share code, notes, and snippets.

@HektorW
Last active August 29, 2015 14:06
Show Gist options
  • Save HektorW/bb0c622277e9269d6962 to your computer and use it in GitHub Desktop.
Save HektorW/bb0c622277e9269d6962 to your computer and use it in GitHub Desktop.
Some common vendor prefixes
// 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