W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2010

Re: requestAnimationFrame

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Sat, 20 Nov 2010 02:35:07 +0100
To: Ojan Vafai <ojan@chromium.org>
Cc: "public-webapps@w3.org" <public-webapps@w3.org>
Message-ID: <1c8ee6t0epco3vcl7m2926n3d7cnfo1ms6@hive.bjoern.hoehrmann.de>
* Ojan Vafai wrote:
>On Fri, Nov 19, 2010 at 2:54 PM, Cameron McCormack <cam@mcc.id.au> wrote:
>> Darin Fisher:
>> I can imagine a situation where you have an animation that goes for,
>> say, 10 seconds, and once the animation finishes something else happens.
>> The 1 second maximum period seems useful in this case, because you might
>> make the tab visible again for a long time, but you expect the
>> “something else” to happen.  It’s pretty natural to do the checking for
>> whether the animation has gone past its end time within the callback.
>
>What's an acutal example where you might want this that couldn't just wait
>until the tab was visible again? This use-case doesn't seem very common. As
>you say, it's also probably not well met due to throttling.

Well, if every event handler has "If time is past my end time, clean up
and unregister the handler" logic, and you do not care about possible
wait times when resuming the tab (for instance, the cleanup may load
additional resources from the network which one might expect to load
in the background), and find shared state manipulation far fetched
(say, on disposal the handler may change cookies or local storage to
indicate, say, you've already watched a full-screen ad on the page),
then the only thing that could leak out of tabs, as far as my browser
is concerned, is audio.

To make up a simple case, you might have a visual progess indicator
where the end time is determined by some network activity: when it
finishes you get an audible "done" indicator and you bind the "done" 
logic to the animation handler, not the network handler. Obviously
that does not address your question, since "couldn't" never applies
here, you could always just use setTimeout and setInterval and burn
cycles, or whatever else gurantees your script runs even when the tab
is in the background, and implement the logic as you see fit.
-- 
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 
Received on Saturday, 20 November 2010 01:35:31 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:42 GMT