W3C home > Mailing lists > Public > www-svg@w3.org > November 2002

SVGWindow interface setInterval/setTimeout

From: Jim Ley <jim@jibbering.com>
Date: Sun, 17 Nov 2002 13:52:39 -0000
Message-ID: <01b101c28e42$97f50c40$1a3c70c2@7020CT>
To: <www-svg@w3.org>

Hi,

setInterval (applies to setTimeout too) is defined as

Object            setInterval ( in DOMString code, in long delay );

firstly you have an inconsistency with clearInterval where the type of the
parameter is "object", but that's a typo I guess, I assume you're using
object to refer to some implementation specific object, what it is is up
to the authors?

Current implementations are not as simple as the above,

setInterval("moo()",1000)
and
setInterval(moo,1000)

are both allowed, and do the same thing - so the first parameter is a
DOMString, the second a function reference, the latter a function
reference is more efficient, and also the only available in at least 1
mobile javascript implementation in the HTML world (the DOMString one
requires a compiler on the device AvantGo for the Palm compiles the script
on a server)

In a mixed script language world, which language is the DOMString assumed
to be?  IE's setTimeout implementation has a 3rd parameter "language"
(although not as mime-type unfortunately)

With the DOMString method, we cannot pass objects to functions being
called, i.e.:

moomin=SVGDoc.getElementsByTagName("rect").item(7)
setTimeout("changeColour(moomin)",1000)
or
setTimeout("changeColour("+moomin+")",1000)

don't do what we would want, and the workarounds are inefficient,
especially with internal rather than DOM objects.  A number of browsers in
the HTML world, including Netscape, allow:

setTimeout(changeColour,1000,moomin)

to do what we want, the same would be nice in SVG.

Jim.
Received on Sunday, 17 November 2002 09:07:18 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:23 GMT