1 |
JavaScript has a pair of timeout methods
|
2 |
// Call setTimeout and assign a handle:
|
3 |
yourID = setTimeout(exp, msecs);
|
4 |
// Abort process started by setTimeout:
|
5 |
clearTimeout(yourID);
|
6 |
setTimeout starts a timer that causes expression exp to be evaluated after a time interval of msecs milliseconds
|
7 |
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!
|
8 |
Note setTimeout does not start a loop, just a single timing. Thus clearTimeout need not be called unless abnormal termination is required
|
9 |
If you want a loop, ensure exp restarts a new setTimeout
|