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

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

From: Aaron Boodman <aa@google.com>
Date: Fri, 3 Oct 2008 10:43:34 -0700
Message-ID: <278fd46c0810031043k722aa4cfo22583b0c446cddf9@mail.gmail.com>
To: "Maciej Stachowiak" <mjs@apple.com>
Cc: "public-webapps@w3.org Group WG" <public-webapps@w3.org>

Hi Maciej,

Thanks for raising this. It's a good addition to the web platform. I'm
definitely +1 to the idea.

2008/10/2 Maciej Stachowiak <mjs@apple.com>:
> // should be implemented by Window objects
> interface WindowTimer {
>    Timer startTimer(in double delayInSeconds, in boolean repeating, in TimerHandler handler);
> }
> - Perhaps the delay should be in possibly-fractional milliseconds rather than possibly-fractional seconds. But expressing microseconds as fractional milliseconds seems quite weird.

To me, fractional milliseconds does not seem weird. On the webkit-dev
thread, Peter Speck pointed out [1] that the unit of time in web
development is milliseconds. Dates are in milliseconds, setTimeout
takes millisecond arguments, etc. So to me, it would be weird to have
a new timer API that suddenly uses seconds. And I tend to agree with
Peter that doing so would be a common source of bugs for web

> - 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.

You mentioned [2] that this is a bit weird because the function can be
quite long and then it reads poorly for anonymous functions.

I see your point, but we already have that problem with setTimeout and
setInterval. And I feel like it's more important to have consistency
where possible with these well-established APIs than fix this issue.

[1] https://lists.webkit.org/pipermail/webkit-dev/2008-October/005273.html
[2] https://lists.webkit.org/pipermail/webkit-dev/2008-October/005251.html

- a
Received on Friday, 3 October 2008 17:44:15 UTC

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