I\' ve made a in JavaScript function to check every 100 ms if a global variable is loaded. When the variable will be loaded the function will return the value of the variable as
I would probably make the remaining arithmetric operations a callback. Something like:
function checkVariable()
{
if ( myvar != null )
{
computeVariable(myVar);
}
else
{
window.setTimeout("checkVariable();",100);
}
}
Then:
// arithmetis operations... [1]
myVar = checkVariable();
function computeVariable(myVar) {
// arithmetic operations that use myVar [2]
}