You can actually add parameters to the setTimeout call:
window.setTimeout(foo,100,"bar","baz");
function foo(){
alert(arguments.length);
for (var arg = 0;arguments[arg];arg++){
alert(arg+": "+arguments[arg]);
}
}
In this case, the length of the arguments will be 3, and the contents will be:
arguments[0] == "bar"; arguments[1] == "baz"; arguments[2] == 12415; // Changes with every new window?
The mystery question is: What is arguments[2]?
// Add a "secret" final argument that indicates timeout lateness
// in milliseconds
LL_SUB(lateness64, now, timeout->mWhen);
LL_L2I(lateness, lateness64);
lateness = PR_IntervalToMilliseconds(lateness);
timeout->mArgv[timeout->mArgc] = INT_TO_JSVAL((jsint) lateness);
Page last modified 15:07, 7 Sep 2005 by Nickolay