Reduce requestAnimationFrame polyfill (#7033)

* Reduce requestAnimationFrame polyfill
* Remove another unnecessary polyfill
This commit is contained in:
Ben McCann 2020-01-30 16:21:30 -08:00 committed by GitHub
parent dac52d189e
commit 4462a2c950
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -101,21 +101,14 @@ export default {
return niceFraction * Math.pow(10, exponent);
},
// Request animation polyfill - https://www.paulirish.com/2011/requestanimationframe-for-smart-animating/
// Request animation polyfill
requestAnimFrame: (function() {
if (typeof window === 'undefined') {
return function(callback) {
callback();
};
}
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function(callback) {
return window.setTimeout(callback, 1000 / 60);
};
return window.requestAnimationFrame;
}()),
// -- Canvas methods
fontString: function(pixelSize, fontStyle, fontFamily) {