Polyfill for RequestAnimationFrame, Refractoring