JavaScript has a pair of timeout methods
|
// Call setTimeout and assign a handle:
|
yourID = setTimeout(exp, msecs);
|
// Abort process started by setTimeout:
|
clearTimeout(yourID);
|
setTimeout starts a timer that causes expression exp to be evaluated after a time interval of msecs milliseconds
|
These methods can be used to animate text or images, or make a display change after a given time interval
-
Also to start a daemon, which monitors what's going on!
|
Note setTimeout does not start a loop, just a single timing. Thus clearTimeout need not be called unless abnormal termination is required
|
If you want a loop, ensure exp restarts a new setTimeout
|