[webkit-dev] Proposed Timer API

Justin Haygood jhaygood at reaktix.com
Thu Oct 2 20:13:32 PDT 2008


How about a static:

Timer::startTimer(function(),delayInSeconds) ?

--------------------------------------------------
From: "Cameron McCormack" <cam at mcc.id.au>
Sent: Thursday, October 02, 2008 9:01 PM
To: "Maciej Stachowiak" <mjs at apple.com>
Cc: <webkit-dev at lists.webkit.org>
Subject: Re: [webkit-dev] Proposed Timer API

> 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();
>
> 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.)
>
> -- 
> Cameron McCormack ≝ http://mcc.id.au/
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
> 


More information about the webkit-dev mailing list