ISSUE-70: what to do about window timers?

http://www.w3.org/2005/06/tracker/webapi/issues/70

Raised by: Maciej Stachowiak
On product: Window

What to do about timers? Some rough options:

A.1) Define in an ECMAScript-only way, and assume other languages all have 
their own built-in timer 
facility. But is that true? In particular, do they have one that is usable in a 
browser scripting context? I 
am not sure, since timer facilities are generally based on some sort of event 
loop, and the browser 
controls the event loop in this case.

A.2) Define using a TimerListener interface which is meant only for other 
languages, while ECMAScript 
only actually allows strings or functions to be passed.

A.3)  Define using a TimerListener interface which is meant only for other 
languages, ECMAScript allows 
strings or functions to be passed, but also allows user objects that implement 
TimerListener.

B.1) Invent a new timer API that's more like the SVG uDOM one (but simpler to 
use, it shouldn't take 4 
lines of code to set up a timer callback in ES). Define the existing 
implemented Window timer methods 
in terms of this for ECMAScript only.

B.2) Like A.2 but also add a nicer timer API for all languages as in B.1.

B.3) Like A.3 but also add a nicer timer API for all languages as in B.1.

For completeness there is also this:

C) Drop timers from the spec, at least for this version.

There is also the question of what TimerListener would look like, I imagine a 
single method that gets 
some kind of timer ID as an argument, but it really depends on which of these 
options we go with.

There is also the option of making it just like an EventListener, but I don't 
think events are a good 
model for timers firing, most toolkit APIs I know of make timers and events 
separate concepts.

This is the one time in writing this spec I have felt the temptation to invent 
a new feature. Someone 
smack me back to reality.



Reply via email to