[webkit-dev] Proposed Timer API

Maciej Stachowiak mjs at apple.com
Thu Oct 2 18:13:19 PDT 2008


On Oct 2, 2008, at 6:01 PM, Cameron McCormack wrote:

> Hi Maciej.
>
> Cameron McCormack:
>>> If possible, it would be nice if there could be some degree of
>>> compatibility between this proposed API and the one in SVG Tiny 1.2:
>>>
>>> http://dev.w3.org/SVG/profiles/1.2T/publish/svgudom.html#svg__SVGTimer
>
> Maciej Stachowiak:
>> I considered that, but I don't like the fact that it makes the common
>> zero-delay continuation callback case into three lines of code  
>> instead
>> of one, for what I think is no practical benefit.
>
> Justin’s proposed API seems to need four lines for that case:
>
>  var t = new Timer();
>  t.repeatCount = 1;
>  t.addEventListener('timercomplete', function() { … }, false);
>  t.start();
>
> compared with the three for SVG’s timer:
>
>  var t = createTimer(0, -1);
>  t.addEventListener('SVGTimer', function() { … }, false);
>  t.start();

See my proposal on another thread, which makes this:

startTimer(0, false, function() { ... });

> Or do you mean compared to a simple function-like API, such as
> setTimeout(), where it can be done in one line?  (Perhaps functions  
> like
> setHighResolution{Interval,Timeout}() would be easiest then.)

Yeah, my proposal is something like that, but just one function and  
without bothering to mention "HighResolution" in the name.

Regards,
Maciej



More information about the webkit-dev mailing list