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

Re: Proposal: High resolution (and otherwise improved) timer API

From: Maciej Stachowiak <mjs@apple.com>
Date: Fri, 03 Oct 2008 05:23:56 -0700
To: Anne van Kesteren <annevk@opera.com>
Cc: "public-webapps@w3.org Group WG" <public-webapps@w3.org>
Message-id: <3C106766-7215-45AB-9499-7667A5AB2017@apple.com>

On Oct 3, 2008, at 4:59 AM, Anne van Kesteren wrote:

> On Fri, 03 Oct 2008 05:43:55 +0200, Maciej Stachowiak  
> <mjs@apple.com> wrote:
>> - Perhaps the argument order should be (handler, delay, repeating)  
>> instead, to be more like setTimeout / setInterval
>> - Perhaps the "repeating" or even the "delayInSeconds" arguments  
>> should be optional, defaulting to false and 0 respectively, and  
>> possibly in combination with the above suggestion.
> I think that would be nice.
> I was wondering why startTimer returns a Timer object. What is the  
> use case for that?

So you can store it and stop the timer, or reset its fire time.  
Currently, setTimeout and setInterval return an integer ID that you  
can use to cancel, which is pretty lame, and the only way to reset a  
timer to fire at a later time would be to cancel the existing timer  
(by integer ID) and have access to the original callback function.

I'm told by developers of some of Google's bigger Web apps that  
resetting a timer to wait longer is a pretty common use case. And an  
object clearly seems like a better way to represent a timer even for  
cancellation purposes than an integer ID.

Received on Friday, 3 October 2008 12:24:37 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:26:12 UTC