Udated to support 'window.requestAnimationFrame'