improve timeout lib using requestframeanimation