Improved requestAnimationFrame detection using a polyfill