August 1, 2000 - Lazy Evaluation
August 1, 2000 Lazy Evaluation Tips: August 2000
Yehuda Shiran, Ph.D.
|
In JavaScript, you can force a recomputation by calling the Document
Object's recalc()
method:
document.recalc(true);
In Column 65, Dynamic Properties, we showed how to program the Solar System. In this example, the need to update the location of the planet is implicit. None of the statements uses the top
and left
parameters of the planets, but the location of the planets in the solar system is determined by these parameters. Hence, to force the update of their location, we call the recalc()
method every time interval:
function triggerRecalculation() {
currentTime = new Date() - timeAt0;
document.recalc(true);
}
For more on Dynamic Properties, go to Column 65, Dynamic Properties.