[webkit-dev] Proposed Timer API

Cameron McCormack cam at mcc.id.au
Thu Oct 2 18:01:40 PDT 2008


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/


More information about the webkit-dev mailing list