Friday, November 15, 2013

requestAnimationFrame will not fire on Mobile Safari if you are already doing too much work in a touch handler

I've lately been writing a whole bunch of front-end stuff for iOS at Brightside. One of the recurring themes is responding smoothly to touch input, with appropriate incremental rendering of the page. At one point I tried to use requestAnimationFrame to offload some of the re-rendering work from a touch handler (that was already doing some work) but that totally didn't work - the frames were not firing for long periods of time.

I've put together a simple demo to show the effect at The gist is that the touchmove handler is using (by default) 100ms for some work and then setting a timer. The demo uses both setTimeout with a wait of 0 and (request|webkitRequest)AnimationFrame and shows how long it takes for the request to fire. The animation frames pretty much don't come at all as long as you keep moving your finger.

This doesn't happen with mouse events on the desktop in either Chrome or Safari.

1 comment:

Anonymous said...

Many people are not snug with seeing these transactions seem of their statements, and with the corporate storing their details. With Bitcoin gambling websites, users have a higher stage of anonymity as they will present fewer details. Crypto transactions are extra anonymous than traditional strategies that are 카지노사이트 linked to a name. It’s a seasonal occasion designed for VIP members, which earns Bitty tokens to players that guess the proper solutions. Seasonal events normally final 3-4 months, during which players earn levels by gambling .